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/streamstack.cpp | 100 ---------------------------------------------- 1 file changed, 100 deletions(-) delete mode 100644 src/tests/streamstack.cpp (limited to 'src/tests/streamstack.cpp') diff --git a/src/tests/streamstack.cpp b/src/tests/streamstack.cpp deleted file mode 100644 index 4a0e128..0000000 --- a/src/tests/streamstack.cpp +++ /dev/null @@ -1,100 +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 "bu/streamstack.h" - -#include "bu/file.h" -#include "bu/base64.h" -#include "bu/bzip2.h" - -#include "bu/sio.h" - -#include - -using namespace Bu; - -class DoStuff -{ -public: - DoStuff( Bu::Stream &rStream ) : - rStream( rStream ) - { - } - - virtual ~DoStuff() - { - } - - void write() - { - Bu::String s; - time_t tNow = time( NULL ); - s = ctime( &tNow ); - long lSize = s.getSize()-1; - rStream.write( &lSize, sizeof(long) ); - rStream.write( s.getStr(), lSize ); - } - - void read() - { - Bu::String s; - long lSize; - rStream.read( &lSize, sizeof(long) ); - s.setSize( lSize ); - rStream.read( s.getStr(), lSize ); - sio << "Read str(" << lSize << ") = '" << s << "'" << sio.nl; - } - -private: - Bu::Stream &rStream; -}; - -int main() -{ - Bu::StreamStack ss; - - DoStuff ds( ss ); - - try - { - ds.write(); - sio << "This shouldn't have worked." << sio.nl; - } - catch( Bu::ExceptionBase &e ) - { - sio << "Got exception, this is good: " << e.what() << sio.nl; - } - - ss.setStream( new Bu::File("Hello.test", Bu::File::WriteNew ) ); - - ds.write(); - - ss.pushFilter(); - - ds.write(); - - ss.pushFilter(); - - ds.write(); - - ss.clear(); - - ss.setStream( new Bu::File("Hello.test", Bu::File::Read ) ); - - ds.read(); - - ss.pushFilter(); - - ds.read(); - - ss.pushFilter(); - - ds.read(); - - return 0; -} - -- cgit v1.2.3