diff options
| -rw-r--r-- | src/fstring.h | 4 | ||||
| -rw-r--r-- | src/unit/fstring.cpp | 17 | 
2 files changed, 16 insertions, 5 deletions
| diff --git a/src/fstring.h b/src/fstring.h index fe3daf1..f52b6f1 100644 --- a/src/fstring.h +++ b/src/fstring.h | |||
| @@ -399,10 +399,12 @@ namespace Bu | |||
| 399 | flatten(); | 399 | flatten(); | 
| 400 | const chr *a = pData; | 400 | const chr *a = pData; | 
| 401 | chr *b = pFirst->pData; | 401 | chr *b = pFirst->pData; | 
| 402 | for( long j = 0; *a!=(chr)0 && j < nLength; j++, a++, b++ ) | 402 | for( long j = 0; *a!=(chr)0 || *b!=(chr)0; j++, a++, b++ ) | 
| 403 | { | 403 | { | 
| 404 | if( *a != *b ) | 404 | if( *a != *b ) | 
| 405 | return false; | 405 | return false; | 
| 406 | if( *a == (chr)0 && j < nLength ) | ||
| 407 | return false; | ||
| 406 | } | 408 | } | 
| 407 | 409 | ||
| 408 | return true; | 410 | return true; | 
| diff --git a/src/unit/fstring.cpp b/src/unit/fstring.cpp index 72755eb..2c6bf7a 100644 --- a/src/unit/fstring.cpp +++ b/src/unit/fstring.cpp | |||
| @@ -7,17 +7,26 @@ public: | |||
| 7 | Unit() | 7 | Unit() | 
| 8 | { | 8 | { | 
| 9 | setName("FString"); | 9 | setName("FString"); | 
| 10 | addTest( Unit::test1 ); | 10 | addTest( Unit::compare1 ); | 
| 11 | addTest( Unit::compare2 ); | ||
| 11 | } | 12 | } | 
| 12 | 13 | ||
| 13 | virtual ~Unit() | 14 | virtual ~Unit() | 
| 14 | { | 15 | { | 
| 15 | } | 16 | } | 
| 16 | 17 | ||
| 17 | void test1() | 18 | void compare1() | 
| 18 | { | 19 | { | 
| 19 | unitTest( 1 == 1 ); | 20 | Bu::FString b("Bob"); | 
| 20 | unitTest( 1 == 0 ); | 21 | unitTest( !(b == "Bobo") ); | 
| 22 | unitTest( b == "Bob" ); | ||
| 23 | } | ||
| 24 | |||
| 25 | void compare2() | ||
| 26 | { | ||
| 27 | Bu::FString b("Bobo"); | ||
| 28 | unitTest( !(b == "Bob") ); | ||
| 29 | unitTest( b == "Bobo" ); | ||
| 21 | } | 30 | } | 
| 22 | }; | 31 | }; | 
| 23 | 32 | ||
