summaryrefslogtreecommitdiff
path: root/src/tests/conduit.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-03-30 22:33:41 +0000
committerMike Buland <eichlan@xagasoft.com>2011-03-30 22:33:41 +0000
commit4b9289cfb260f4bcecaf23a810584ef6ef8e8501 (patch)
tree79136af08c7e42ba3322f0d73e9779e4354b318a /src/tests/conduit.cpp
parentc7636dc954eddfe58f7959392602fbc9072d77e7 (diff)
downloadlibbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.gz
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.bz2
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.xz
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.zip
Ok, string stuff is working much, much better, a load of new unit tests have
been added, and I deleted a whole slew of stupid old tests that I don't need.
Diffstat (limited to 'src/tests/conduit.cpp')
-rw-r--r--src/tests/conduit.cpp56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/tests/conduit.cpp b/src/tests/conduit.cpp
deleted file mode 100644
index d8d9e03..0000000
--- a/src/tests/conduit.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
1#include "bu/conduit.h"
2#include "bu/sio.h"
3#include "bu/ito.h"
4
5using namespace Bu;
6
7class Reader : public Bu::Ito
8{
9public:
10 Reader( Bu::Conduit &rCond ) :
11 rCond( rCond )
12 {
13 }
14
15 virtual ~Reader()
16 {
17 }
18
19protected:
20 virtual void run()
21 {
22 while( rCond.isOpen() )
23 {
24 char buf[1025];
25
26 sio << "Reading..." << sio.flush;
27 Bu::size iRead = rCond.read( buf, 1024 );
28 buf[iRead] = '\0';
29 sio << "got " << iRead << " >" << buf << "<" << sio.nl;
30 }
31
32 sio << "Conduit closed, exting thread." << sio.nl;
33 }
34
35private:
36 Bu::Conduit &rCond;
37};
38
39int main()
40{
41 Conduit c;
42 Reader r( c );
43 r.start();
44
45 sleep( 3 );
46 c.write("Hi there", 8 );
47 sleep( 3 );
48 c.write("Goodbye, soon.", 14 );
49 sleep( 3 );
50 c.write("...NOW!", 9 );
51 c.close();
52 sleep( 3 );
53
54 return 0;
55}
56