From 45e065bc4fc93731ea9a0543462bc7cf9e6084d7 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 7 Jan 2009 15:59:57 +0000 Subject: Only two real changes. First, Bu::FString and Bu::FBasicString are in different files. This won't affect any programs at all anywhere. This will just make it easier to maintain and extend later. You still want to include "bu/fstring.h" and use Bu::FString in code. The other is kinda fun. I created a special format for unit tests, they use the extension .unit now and use the mkunit.sh script to convert them to c++ code. There are some nice features here too, maintaining unit tests is much, much easier, and we can have more features without making the code any harder to use. Also, it will be easier to have the unit tests generate reports and be run from a master program and the like. --- src/unit/membuf.cpp | 60 ----------------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 src/unit/membuf.cpp (limited to 'src/unit/membuf.cpp') diff --git a/src/unit/membuf.cpp b/src/unit/membuf.cpp deleted file mode 100644 index dc02aa3..0000000 --- a/src/unit/membuf.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2007-2008 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/unitsuite.h" -#include "bu/membuf.h" - -class Unit : public Bu::UnitSuite -{ -public: - Unit() - { - setName("MemBuf"); - addTest( Unit::testWriteRead01 ); - addTest( Unit::testOverwrite1 ); - } - - virtual ~Unit() - { - } - - void testWriteRead01() - { - Bu::MemBuf mb; - unitTest( mb.write("ab", 2 ) == 2 ); - unitTest( mb.write("cde", 3 ) == 3 ); - unitTest( mb.write("FG", 2 ) == 2 ); - - mb.setPos( 0 ); - - char buf[8]; - buf[7] = '\0'; - unitTest( mb.read( buf, 7 ) == 7 ); - unitTest( !strncmp( buf, "abcdeFG", 7 ) ); - unitTest( mb.read( buf, 7 ) == 0 ); - mb.seek( -3 ); - unitTest( mb.read( buf, 7 ) == 3 ); - unitTest( !strncmp( buf, "eFG", 3 ) ); - } - - void testOverwrite1() - { - Bu::MemBuf mb; - unitTest( mb.write("0123456789") == 10 ); - mb.setPos( 4 ); - unitTest( mb.write("-5-") == 3 ); - mb.setPos( 9 ); - mb.write("Hey!!!"); - unitTest( mb.tell() == 15 ); - char buf[50]; - mb.setPos( 0 ); - buf[mb.read( buf, 50 )] = '\0'; - unitTest( !strcmp( buf, "0123-5-78Hey!!!" ) ); - } -}; - -int main( int argc, char *argv[] ){ return Unit().run( argc, argv ); } -- cgit v1.2.3