aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-09 16:25:22 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-09 16:25:22 +0000
commit74dd68ad611d15abf16a65c36a7cfd3f4492930a (patch)
tree843fed9ba6bb03253a01314afc3b1dfbb2dfd26c /src/tests
parentd9b407475ae3ebe434b29d9eabdd7d4416e17881 (diff)
downloadlibgats-74dd68ad611d15abf16a65c36a7cfd3f4492930a.tar.gz
libgats-74dd68ad611d15abf16a65c36a7cfd3f4492930a.tar.bz2
libgats-74dd68ad611d15abf16a65c36a7cfd3f4492930a.tar.xz
libgats-74dd68ad611d15abf16a65c36a7cfd3f4492930a.zip
Made the repo less libbu++-centric.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/clone.cpp22
-rw-r--r--src/tests/dump.cpp30
-rw-r--r--src/tests/int.cpp47
3 files changed, 0 insertions, 99 deletions
diff --git a/src/tests/clone.cpp b/src/tests/clone.cpp
deleted file mode 100644
index 8533376..0000000
--- a/src/tests/clone.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
1#include "gats/types.h"
2
3#include <bu/sio.h>
4
5using namespace Bu;
6
7int main( int argc, char *argv[] )
8{
9 Gats::Object *pBase = Gats::Object::strToGats("{\"Thing\": 3.14159, \"bool\": true, \"list\":[\"string\",44,{\"Stuff\":{\"list\":[],\"what?\":false}}]}");
10
11 sio << *pBase << sio.nl;
12
13 Gats::Object *pNew = pBase->clone();
14 delete pBase;
15
16 sio << *pNew << sio.nl;
17
18 delete pNew;
19
20 return 0;
21}
22
diff --git a/src/tests/dump.cpp b/src/tests/dump.cpp
deleted file mode 100644
index e0dcb52..0000000
--- a/src/tests/dump.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
1#include <bu/sio.h>
2#include <bu/file.h>
3#include <gats/gatsstream.h>
4#include <gats/types.h>
5
6using namespace Bu;
7
8int main( int argc, char *argv[] )
9{
10 File fIn( argv[1], File::Read );
11 Gats::GatsStream gsIn( fIn );
12
13 for(;;)
14 {
15 sio << "Reading from file position: " << fIn.tell() << sio.nl;
16 Gats::Object *pObj = gsIn.readObject();
17 if( !pObj )
18 {
19 if( gsIn.hasReadBuffer() )
20 {
21 sio << "Premature end of stream detected, have "
22 << gsIn.getReadBufferSize() << "b." << sio.nl;
23 }
24 return 0;
25 }
26
27 sio << *pObj << sio.nl;
28 }
29}
30
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
7using namespace Bu;
8
9void 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
25int 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