summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-05-10 03:31:08 +0000
committerMike Buland <eichlan@xagasoft.com>2010-05-10 03:31:08 +0000
commit8baf7e1e75a185c742dc6d5b27e50058635e5522 (patch)
tree76ccf80b005c85df2d887ccda73679cae8d28a26 /src/tests
parent51c5bfa4881b5def142092e10dd402fd40e2e712 (diff)
downloadlibbu++-8baf7e1e75a185c742dc6d5b27e50058635e5522.tar.gz
libbu++-8baf7e1e75a185c742dc6d5b27e50058635e5522.tar.bz2
libbu++-8baf7e1e75a185c742dc6d5b27e50058635e5522.tar.xz
libbu++-8baf7e1e75a185c742dc6d5b27e50058635e5522.zip
Added the new QueueBuf. It's brilliant, and I've wanted it for a long time.
...I mean brilliant as in cool.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/queuebuf.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tests/queuebuf.cpp b/src/tests/queuebuf.cpp
new file mode 100644
index 0000000..accc723
--- /dev/null
+++ b/src/tests/queuebuf.cpp
@@ -0,0 +1,23 @@
1#include <bu/queuebuf.h>
2#include <bu/sio.h>
3
4using namespace Bu;
5
6int main()
7{
8 static const char *src = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789%#";
9 QueueBuf qb;
10
11 for( int j = 0; j < 8; j++ )
12 {
13 qb.write( src, 60 );
14 }
15
16 char buf[11];
17 while( !qb.isEos() )
18 {
19 buf[qb.read( buf, 9 )] = '\0';
20 sio << "Read: >>" << buf << "<<" << sio.nl;
21 }
22}
23