From cf847cc534a2a7ad06750c446028b7c6d126fe21 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 15 Mar 2007 05:24:58 +0000 Subject: Looks like FString is ready for general consumption, not too shabby. --- src/tests/fstring.cpp | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'src/tests/fstring.cpp') diff --git a/src/tests/fstring.cpp b/src/tests/fstring.cpp index 26905ac..cb85282 100644 --- a/src/tests/fstring.cpp +++ b/src/tests/fstring.cpp @@ -1,28 +1,37 @@ #include "fstring.h" -int main( int argc, char *argv ) +FString genThing() { - FString str("[] this won't be in there", 3); - - str.append("Hello"); - str.append(" th"); - str.append("ere."); + FString bob; + bob.append("ab "); + bob += "cd "; + bob += "efg"; - if( str == "[] Hello there." ) - printf("1) check\n"); + printf("---bob------\n%08X: %s\n", (unsigned int)bob.c_str(), bob.c_str() ); + return bob; +} - if( str != "[] Hello there. " ) - printf("2) check\n"); +#define pem printf("---------\n%08X: %s\n%08X: %s\n", (unsigned int)str.c_str(), str.c_str(), (unsigned int)str2.c_str(), str2.c_str() ); +int main( int argc, char *argv ) +{ + FString str("th"); - if( str != "[] Hello there." ) - printf("3) failed\n"); - else - printf("3) check\n"); + str.prepend("Hello "); + str.append("ere."); - str += " How are you?"; + FString str2( str ); + pem; + str += " What's up?"; + pem; + str2 += " How are you?"; + pem; + str = str2; + pem; - str.prepend("Bob says: "); + str2 = genThing(); + pem; - printf("%s\n", str.c_str() ); + str = str2; + pem; } -- cgit v1.2.3