summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/list2.cpp19
-rw-r--r--src/tests/queuebuf.cpp42
2 files changed, 58 insertions, 3 deletions
diff --git a/src/tests/list2.cpp b/src/tests/list2.cpp
new file mode 100644
index 0000000..cd02aef
--- /dev/null
+++ b/src/tests/list2.cpp
@@ -0,0 +1,19 @@
1#include <bu/list.h>
2#include <bu/sio.h>
3
4using namespace Bu;
5
6int main()
7{
8 List<int64_t> lInt;
9
10 lInt.append( 512 );
11 lInt.append( 1024 );
12 lInt.append( 4096 );
13 lInt.append( 12 );
14 lInt.erase( 12 );
15 lInt.append( 12 );
16 lInt.erase( 12 );
17 lInt.append( 12 );
18}
19
diff --git a/src/tests/queuebuf.cpp b/src/tests/queuebuf.cpp
index accc723..677df16 100644
--- a/src/tests/queuebuf.cpp
+++ b/src/tests/queuebuf.cpp
@@ -13,11 +13,47 @@ int main()
13 qb.write( src, 60 ); 13 qb.write( src, 60 );
14 } 14 }
15 15
16 char buf[11]; 16 char buf[11], bufp[11];
17 while( !qb.isEos() ) 17 while( !qb.isEos() )
18 { 18 {
19 buf[qb.read( buf, 9 )] = '\0'; 19 int iAmntPeek = qb.peek( bufp, 9 );
20 sio << "Read: >>" << buf << "<<" << sio.nl; 20 int iAmntRead = qb.read( buf, 9 );
21 if( iAmntPeek != iAmntRead )
22 sio << "Differ: " << iAmntPeek << " vs " << iAmntRead << sio.nl;
23 buf[iAmntRead] = '\0';
24 bufp[iAmntPeek] = '\0';
25 if( memcmp( buf, bufp, iAmntPeek ) )
26 {
27 sio << "Buffers differ" << sio.nl
28 << " " << buf << sio.nl
29 << " " << bufp << sio.nl;
30 }
31 else
32 sio << "Read: >>" << buf << "<<" << sio.nl;
33 }
34
35 sio << sio.nl << sio.nl << sio.nl << "Seek test:" << sio.nl << sio.nl;
36
37 for( int j = 0; j < 5; j++ )
38 {
39 qb.write( src, 25 );
40 qb.write( src+10, 25 );
41 }
42
43 char bufa[26];
44 char bufb[26];
45 ::memcpy( bufb, src+10, 15 );
46 ::memcpy( bufb+15, src+10, 10 );
47 bufb[25] = '\0';
48 sio << "Comparing to '" << bufb << "'" << sio.nl;
49 qb.seek( 10 );
50 while( !qb.isEos() )
51 {
52 bufa[qb.read( bufa, 25 )] = '\0';
53 qb.seek( 25 );
54 if( memcmp( bufa, bufb, 25 ) )
55 sio << "Differ?" << sio.nl;
56 sio << "=== '" << bufa << "' == '" << bufb << "'" << sio.nl;
21 } 57 }
22} 58}
23 59