From 4b9289cfb260f4bcecaf23a810584ef6ef8e8501 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 30 Mar 2011 22:33:41 +0000 Subject: 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. --- src/tests/itoqueue2.cpp | 87 ------------------------------------------------- 1 file changed, 87 deletions(-) delete mode 100644 src/tests/itoqueue2.cpp (limited to 'src/tests/itoqueue2.cpp') diff --git a/src/tests/itoqueue2.cpp b/src/tests/itoqueue2.cpp deleted file mode 100644 index 10bc566..0000000 --- a/src/tests/itoqueue2.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2007-2011 Xagasoft, All rights reserved. - * - * This file is part of the libbu++ library and is released under the - * terms of the license contained in the file LICENSE. - */ - -#include -#include "bu/ito.h" -#include "bu/itoqueue.h" -#include -#include - -class Reader : public Bu::Ito -{ -public: - Reader( Bu::ItoQueue &q, int id ) : - q( q ), - id( id ) - { - } - - void run() - { - for( int i = 0; i < 10; i++ ) - { - std::string *pStr = q.dequeue( 0, 500000 ); - if( pStr == NULL ) - { - printf("Null received...\n"); - i--; - } - else - { - printf("[%d] read: %s\n", id, pStr->c_str() ); - delete pStr; - } - } - } - -private: - Bu::ItoQueue &q; - int id; -}; - -class Writer : public Bu::Ito -{ -public: - Writer( Bu::ItoQueue &q, int id, const char *strbase ) : - q( q ), - strbase( strbase ), - id( id ) - { - } - - void run() - { - for( int i = 0; i < 11; i++ ) - { - sleep( 2 ); - printf("[%d] write: %s\n", id, strbase ); - q.enqueue( new std::string( strbase ) ); - } - } - -private: - Bu::ItoQueue &q; - const char *strbase; - int id; -}; - -int main() -{ - printf("ETIMEDOUT: %d\n", ETIMEDOUT ); - Bu::ItoQueue q; - Writer wr( q, 0, "writer" ); - Reader rd( q, 0 ); - - rd.start(); - wr.start(); - - rd.join(); - wr.join(); - - return 0; -} - -- cgit v1.2.3