diff options
Diffstat (limited to 'src/tests/int.cpp')
-rw-r--r-- | src/tests/int.cpp | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/tests/int.cpp b/src/tests/int.cpp deleted file mode 100644 index c19df9c..0000000 --- a/src/tests/int.cpp +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | #include "gats/integer.h" | ||
2 | |||
3 | #include <bu/sio.h> | ||
4 | #include <bu/membuf.h> | ||
5 | #include <stdlib.h> | ||
6 | |||
7 | using namespace Bu; | ||
8 | |||
9 | void hexdump( char *dat, int iSize ) | ||
10 | { | ||
11 | static const char *hex="0123456789ABCDEF"; | ||
12 | printf("----\n"); | ||
13 | for( int j = 0; j < iSize; j += 8 ) | ||
14 | { | ||
15 | for( int k = j; /*k < iSize &&*/ k < j+8; k++ ) | ||
16 | printf((k<iSize)?"%c%c ":" ", hex[(dat[k]>>4)&0x0F], hex[dat[k]&0x0F] ); | ||
17 | printf("| "); | ||
18 | for( int k = j; k < iSize && k < j+8; k++ ) | ||
19 | printf("%c ", (dat[k]>13&&dat[k]<127)?(dat[k]):('.') ); | ||
20 | printf("\n"); | ||
21 | } | ||
22 | printf("----\n"); | ||
23 | } | ||
24 | |||
25 | int main( int argc, char *argv[] ) | ||
26 | { | ||
27 | for( int j = 1; j < argc; j++ ) | ||
28 | { | ||
29 | int64_t i = strtoll( argv[j], NULL, 10 ); | ||
30 | MemBuf mb; | ||
31 | Gats::Integer::writePackedInt( mb, i ); | ||
32 | hexdump( mb.getString().getStr(), mb.getString().getSize() ); | ||
33 | } | ||
34 | /* | ||
35 | sio << "Before: " << i << sio.nl; | ||
36 | Gats::Integer::writePackedInt( mb, i ); | ||
37 | mb.write("aaa", 3 ); | ||
38 | mb.setPos( 0 ); | ||
39 | Gats::Integer::readPackedInt( mb, i ); | ||
40 | sio << "After: " << i << sio.nl; | ||
41 | char buf[4]; | ||
42 | buf[mb.read( buf, 3 )] = '\0'; | ||
43 | sio << "Extra: \"" << buf << "\"" << sio.nl; | ||
44 | */ | ||
45 | return 0; | ||
46 | } | ||
47 | |||