From f5aca1a1b402bd7ebc944dc6e6fe65828d863365 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 20 Jan 2011 02:14:08 +0000 Subject: Bu::FString is now String, and there's a shell script to fix any other programs that were using fstring, I hope. --- src/unit/archive.unit | 14 +++--- src/unit/array.unit | 2 +- src/unit/buffer.unit | 4 +- src/unit/fstring.unit | 134 ++++++++++++++++++++++++------------------------- src/unit/hash.unit | 10 ++-- src/unit/list.unit | 2 +- src/unit/myriad.unit | 20 ++++---- src/unit/queuebuf.unit | 12 ++--- src/unit/taf.unit | 6 +-- src/unit/xml.unit | 4 +- 10 files changed, 104 insertions(+), 104 deletions(-) (limited to 'src/unit') diff --git a/src/unit/archive.unit b/src/unit/archive.unit index a7f2640..07e5e11 100644 --- a/src/unit/archive.unit +++ b/src/unit/archive.unit @@ -105,7 +105,7 @@ suite Archive MemBuf mb; { Archive ar( mb, Archive::save ); - FString sStr("This is a test string."); + String sStr("This is a test string."); List lList; lList.append( 10 ); lList.append( 20 ); @@ -118,7 +118,7 @@ suite Archive mb.setPos( 0 ); { Archive ar( mb, Archive::load ); - FString sStr; + String sStr; List lList; ar >> sStr; ar >> lList; @@ -138,7 +138,7 @@ suite Archive MemBuf mb; { Archive ar( mb, Archive::save ); - FString sStr("This is a test string."); + String sStr("This is a test string."); Array lArray; lArray.append( 10 ); lArray.append( 20 ); @@ -151,7 +151,7 @@ suite Archive mb.setPos( 0 ); { Archive ar( mb, Archive::load ); - FString sStr; + String sStr; Array lArray; ar >> sStr; ar >> lArray; @@ -171,7 +171,7 @@ suite Archive MemBuf mb; { Archive ar( mb, Archive::save ); - Array lArray; + Array lArray; lArray.append( "10" ); lArray.append( "20" ); lArray.append( "30" ); @@ -182,10 +182,10 @@ suite Archive mb.setPos( 0 ); { Archive ar( mb, Archive::load ); - Array lArray; + Array lArray; ar >> lArray; unitTest( lArray.getSize() == 4 ); - Array::iterator i = lArray.begin(); + Array::iterator i = lArray.begin(); unitTest( *i == "10" ); i++; unitTest( *i == "20" ); i++; unitTest( *i == "30" ); i++; diff --git a/src/unit/array.unit b/src/unit/array.unit index f3fdeda..4dc75d8 100644 --- a/src/unit/array.unit +++ b/src/unit/array.unit @@ -55,7 +55,7 @@ suite Array test copy { - typedef Bu::Hash StrHash; + typedef Bu::Hash StrHash; typedef Bu::Array StrHashArray; StrHash h1; diff --git a/src/unit/buffer.unit b/src/unit/buffer.unit index 8ed1ec5..2a8f846 100644 --- a/src/unit/buffer.unit +++ b/src/unit/buffer.unit @@ -14,12 +14,12 @@ suite Buffer { test emptyFile { - Bu::FString sTmp("empty-XXXXXX"); + Bu::String sTmp("empty-XXXXXX"); Bu::File fEmpty = tempFile(sTmp); Bu::Buffer buf( fEmpty ); unitTest( buf.isEos() == false ); - Bu::FString sLine = buf.readLine(); + Bu::String sLine = buf.readLine(); unitTest( sLine == "" ); unitTest( fEmpty.isEos() == true ); unitTest( buf.isEos() == true ); diff --git a/src/unit/fstring.unit b/src/unit/fstring.unit index c6d7414..d282052 100644 --- a/src/unit/fstring.unit +++ b/src/unit/fstring.unit @@ -6,29 +6,29 @@ * terms of the license contained in the file LICENSE. */ -#include "bu/fstring.h" +#include "bu/string.h" #include -suite FString +suite String { test compare1 { - Bu::FString b("Bob"); + Bu::String b("Bob"); unitTest( !(b == "Bobo") ); unitTest( b == "Bob" ); } test compare2 { - Bu::FString b("Bobo"); + Bu::String b("Bobo"); unitTest( !(b == "Bob") ); unitTest( b == "Bobo" ); } test appendSingle { - Bu::FString b; + Bu::String b; for( char l = 'a'; l < 'g'; l++ ) b += l; unitTest( b == "abcdef" ); @@ -37,8 +37,8 @@ suite FString test shared1 { - Bu::FString a("Hey there"); - Bu::FString b( a ); + Bu::String a("Hey there"); + Bu::String b( a ); unitTest( a.getConstStr() == b.getConstStr() ); b += " guy"; unitTest( a.getConstStr() != b.getConstStr() ); @@ -48,7 +48,7 @@ suite FString test insert { - Bu::FString a("abcd"); + Bu::String a("abcd"); a.insert( 2, "-!-", 3 ); unitTest( a == "ab-!-cd" ); @@ -67,7 +67,7 @@ suite FString test remove { - Bu::FString a("abHEYcd"); + Bu::String a("abHEYcd"); a.remove( 2, 3 ); unitTest( a == "abcd" ); a.remove( 2, 5 ); @@ -79,42 +79,42 @@ suite FString test add1 { - Bu::FString a("hi there"); - Bu::FString b(", yeah!"); - Bu::FString c = a + b; + Bu::String a("hi there"); + Bu::String b(", yeah!"); + Bu::String c = a + b; unitTest( c == "hi there, yeah!" ); } test add2 { - Bu::FString a("hi there"); - Bu::FString c = a + ", yeah!"; + Bu::String a("hi there"); + Bu::String c = a + ", yeah!"; unitTest( c == "hi there, yeah!" ); } test add3 { - Bu::FString a("hi there"); - Bu::FString b(", yeah!"); - Bu::FString c = a + ", Mr. Man" + b; + Bu::String a("hi there"); + Bu::String b(", yeah!"); + Bu::String c = a + ", Mr. Man" + b; unitTest( c == "hi there, Mr. Man, yeah!" ); } test add4 { - Bu::FString b(", yeah!"); - Bu::FString c = "hi there" + b; + Bu::String b(", yeah!"); + Bu::String c = "hi there" + b; unitTest( c == "hi there, yeah!" ); } test add5 { - Bu::FString b; - Bu::FString c = "sup?"; + Bu::String b; + Bu::String c = "sup?"; b += "hey, " + c; unitTest( b == "hey, sup?" ); @@ -122,17 +122,17 @@ suite FString test add6 { - Bu::FString a("Hello"); + Bu::String a("Hello"); char b[256] = {"Dude"}; - Bu::FString c = a + "/" + b; + Bu::String c = a + "/" + b; unitTest( c == "Hello/Dude" ); } test add7 { - const Bu::FString a("hello "); - Bu::FString b(" how "); + const Bu::String a("hello "); + Bu::String b(" how "); unitTest( a == "hello " ); unitTest( a + "dude" == "hello dude" ); unitTest( a + "dude" + b + "are you?" == "hello dude how are you?" ); @@ -140,16 +140,16 @@ suite FString test subStr1 { - Bu::FString a("abcdefghijklmnop"); - Bu::FString::iterator i = a.find('f'); - unitTest( a.getSubStr( i, Bu::FString::iterator() ) == "fghijklmnop" ); - Bu::FString::iterator j = i.find('l'); + Bu::String a("abcdefghijklmnop"); + Bu::String::iterator i = a.find('f'); + unitTest( a.getSubStr( i, Bu::String::iterator() ) == "fghijklmnop" ); + Bu::String::iterator j = i.find('l'); unitTest( a.getSubStr( i, j ) == "fghijk" ); } test compareSub1 { - Bu::FString a("just a string."); + Bu::String a("just a string."); unitTest( a.compareSub("a ", 5, 2) == true ); unitTest( a.compareSub("string.aoeu", 7, 11 ) == false ); unitTest( a.compareSub("string.aoeu", 7, 3 ) == true ); @@ -157,17 +157,17 @@ suite FString test compareSub2 { - Bu::FString a("just a string."); - unitTest( a.compareSub(Bu::FString("a "), 5, 2) == true ); - unitTest( a.compareSub(Bu::FString("string.aoeu"), 7, 11 ) == false ); - unitTest( a.compareSub(Bu::FString("string.aoeu"), 7, 3 ) == true ); + Bu::String a("just a string."); + unitTest( a.compareSub(Bu::String("a "), 5, 2) == true ); + unitTest( a.compareSub(Bu::String("string.aoeu"), 7, 11 ) == false ); + unitTest( a.compareSub(Bu::String("string.aoeu"), 7, 3 ) == true ); } test iterator1 { - Bu::FString a("This is a test."); - Bu::FString b; - for( Bu::FString::iterator i = a.begin(); i; i++ ) + Bu::String a("This is a test."); + Bu::String b; + for( Bu::String::iterator i = a.begin(); i; i++ ) { b += *i; } @@ -176,10 +176,10 @@ suite FString test iterator2 { - Bu::FString a("This is a test."); - Bu::FString b("--This is a test."); - Bu::FString::iterator ai = a.begin(); - Bu::FString::iterator bi = b.begin(); + Bu::String a("This is a test."); + Bu::String b("--This is a test."); + Bu::String::iterator ai = a.begin(); + Bu::String::iterator bi = b.begin(); unitTest( ai.compare( bi ) == false ); unitTest( bi.compare( ai ) == false ); bi++; bi++; @@ -189,10 +189,10 @@ suite FString test iterator3 { - Bu::FString a("1234honour"); - Bu::FString b("--1234ueje"); - Bu::FString::iterator ai = a.begin(); - Bu::FString::iterator bi = b.begin(); + Bu::String a("1234honour"); + Bu::String b("--1234ueje"); + Bu::String::iterator ai = a.begin(); + Bu::String::iterator bi = b.begin(); unitTest( ai.compare( bi, 4 ) == false ); unitTest( bi.compare( ai, 4 ) == false ); bi++; bi++; @@ -205,8 +205,8 @@ suite FString test iterator4 { - Bu::FString a("1234aoeu"); - Bu::FString::iterator ai = a.begin(); + Bu::String a("1234aoeu"); + Bu::String::iterator ai = a.begin(); unitTest( ai.compare("1234") == false ); unitTest( ai.compare("1234aoeu") == true ); unitTest( ai.compare("1234aoeuee") == false ); @@ -214,8 +214,8 @@ suite FString test iterator5 { - Bu::FString a("1234aoeu"); - Bu::FString::iterator ai = a.begin(); + Bu::String a("1234aoeu"); + Bu::String::iterator ai = a.begin(); unitTest( ai.compare("1234", 4) == true ); unitTest( ai.compare("1234aoeu", 8) == true ); unitTest( ai.compare("1234aoeuee", 10) == false ); @@ -223,9 +223,9 @@ suite FString test iterator6 { - Bu::FString a("just ->this part"); - Bu::FString b; - Bu::FString::iterator s = a.begin(); + Bu::String a("just ->this part"); + Bu::String b; + Bu::String::iterator s = a.begin(); for(; s; s++ ) { if( *s == '>' ) @@ -239,7 +239,7 @@ suite FString b.append( s ); - Bu::FString c; + Bu::String c; c.set( b.begin() ); // This is here because the comparison operator used to cause flattening. @@ -249,9 +249,9 @@ suite FString test iterator7 { - Bu::FString a("just [this] part"); - Bu::FString b; - Bu::FString::iterator s = a.begin(); + Bu::String a("just [this] part"); + Bu::String b; + Bu::String::iterator s = a.begin(); for(; s; s++ ) { if( *s == '[' ) @@ -260,7 +260,7 @@ suite FString break; } } - Bu::FString::iterator e = s; + Bu::String::iterator e = s; for(; e; e++ ) { if( *e == ']' ) @@ -273,9 +273,9 @@ suite FString b.append( s, e ); - for( Bu::FString::iterator i = b.begin(); i;) + for( Bu::String::iterator i = b.begin(); i;) { - Bu::FString::iterator k = i; + Bu::String::iterator k = i; k++; if( !k ) { @@ -284,12 +284,12 @@ suite FString } i = k; } - Bu::FString l; + Bu::String l; l.set( b.begin() ); unitTest( l == "thisthisthisthi" ); - for( Bu::FString::iterator i = b.begin(); i;) + for( Bu::String::iterator i = b.begin(); i;) { - Bu::FString::iterator k = i; + Bu::String::iterator k = i; k++; if( !k ) { @@ -304,7 +304,7 @@ suite FString test isSet1 { - Bu::FString bob; + Bu::String bob; unitTest( bob.isSet() == false ); bob = "something"; @@ -315,7 +315,7 @@ suite FString test swap1 { - Bu::FString a, b; + Bu::String a, b; a = "Goodbye"; b = "Hello"; Bu::swap( a, b ); @@ -325,7 +325,7 @@ suite FString test swap2 { - Bu::FString a, b; + Bu::String a, b; a = "Goodbye"; b = "Hello"; std::swap( a, b ); @@ -335,14 +335,14 @@ suite FString test replace1 { - Bu::FString a; + Bu::String a; a = "This is a test."; unitTest( a.replace("i", "ooo") == "Thooos ooos a test." ); } test coreDerefBug1 { - Bu::FString a, b; + Bu::String a, b; a = "bob"; a.setSize( 0 ); b = a; diff --git a/src/unit/hash.unit b/src/unit/hash.unit index 124b074..2c1cf6a 100644 --- a/src/unit/hash.unit +++ b/src/unit/hash.unit @@ -6,14 +6,14 @@ * terms of the license contained in the file LICENSE. */ -#include "bu/fstring.h" +#include "bu/string.h" #include "bu/hash.h" #include -typedef Bu::Hash StrIntHash; -typedef Bu::Hash StrStrHash; -typedef Bu::Hash IntStrHash; +typedef Bu::Hash StrIntHash; +typedef Bu::Hash StrStrHash; +typedef Bu::Hash IntStrHash; suite Hash { @@ -24,7 +24,7 @@ suite Hash for(int i=1;i<10000;i++) { sprintf(buf,"%d",i); - Bu::FString sTmp(buf); + Bu::String sTmp(buf); h[sTmp] = i; unitTest( h.has(sTmp) ); } diff --git a/src/unit/list.unit b/src/unit/list.unit index 66e45b2..24346a3 100644 --- a/src/unit/list.unit +++ b/src/unit/list.unit @@ -6,7 +6,7 @@ * terms of the license contained in the file LICENSE. */ -#include "bu/fstring.h" +#include "bu/string.h" #include "bu/list.h" typedef Bu::List IntList; diff --git a/src/unit/myriad.unit b/src/unit/myriad.unit index ad8fb5d..5ac80a0 100644 --- a/src/unit/myriad.unit +++ b/src/unit/myriad.unit @@ -6,7 +6,7 @@ * terms of the license contained in the file LICENSE. */ -#include "bu/fstring.h" +#include "bu/string.h" #include "bu/file.h" #include "bu/myriad.h" #include "bu/myriadstream.h" @@ -56,7 +56,7 @@ Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const VerifyObject &vo ) { int iRand = random()%128; // ar << iRand; - Bu::FString sDat( iRand ); + Bu::String sDat( iRand ); for( int j = 0; j < iRand; j++ ) sDat[j] = (char)((uint8_t)(random()%256)); ar << sDat; @@ -64,7 +64,7 @@ Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const VerifyObject &vo ) sum.addData( sDat.getStr(), iRand ); vo.iBytesWritten += 4 + iRand; } - Bu::FString sRes = sum.getResult(); + Bu::String sRes = sum.getResult(); ar << sRes; vo.iBytesWritten += 4 + sRes.getSize(); return ar; @@ -79,13 +79,13 @@ Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, VerifyObject &vo ) { int iRand; // ar >> iRand; - Bu::FString sStr; + Bu::String sStr; ar >> sStr; iRand = sStr.getSize(); sum.addData( &iRand, 4 ); sum.addData( sStr.getStr(), iRand ); } - Bu::FString sSum; + Bu::String sSum; ar >> sSum; unitTest( sSum == sum.getResult() ); int iTooMuch; @@ -104,7 +104,7 @@ suite Myriad { test setSize { - FString sFileName("myriad-XXXXXXX"); + String sFileName("myriad-XXXXXXX"); File fMyriad = tempFile( sFileName ); Myriad m( fMyriad, 32 ); @@ -194,7 +194,7 @@ suite Myriad test stressGrow { - FString sFileName("myriad-XXXXXXX"); + String sFileName("myriad-XXXXXXX"); File fMyriad = tempFile( sFileName ); Myriad m( fMyriad ); @@ -256,7 +256,7 @@ suite Myriad test stressTruncate { - FString sFileName("myriad-XXXXXXX"); + String sFileName("myriad-XXXXXXX"); File fMyriad = tempFile( sFileName ); Myriad m( fMyriad ); @@ -289,7 +289,7 @@ suite Myriad test stressTruncate2 { - FString sFileName("myriad-XXXXXXX"); + String sFileName("myriad-XXXXXXX"); Array aStream; @@ -329,7 +329,7 @@ suite Myriad test stressArchive { - FString sFileName("myriad-XXXXXX"); + String sFileName("myriad-XXXXXX"); Array aStream; srandom( 2096 ); diff --git a/src/unit/queuebuf.unit b/src/unit/queuebuf.unit index 29ba858..8de29e4 100644 --- a/src/unit/queuebuf.unit +++ b/src/unit/queuebuf.unit @@ -30,7 +30,7 @@ suite QueueBuf unitTest( qb.read( buf, 7 ) == 0 ); } - void QBUF_RANDSTR( Bu::FString &fill, unsigned int iSize ) + void QBUF_RANDSTR( Bu::String &fill, unsigned int iSize ) { char c; for( unsigned int i=0; i "); + Bu::String sXml(" "); Bu::MemBuf buf( sXml ); Bu::XmlReader xr( buf ); } -- cgit v1.2.3