diff options
Diffstat (limited to '')
-rw-r--r-- | src/tests/fstring.cpp | 43 |
1 files changed, 26 insertions, 17 deletions
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 @@ | |||
1 | #include "fstring.h" | 1 | #include "fstring.h" |
2 | 2 | ||
3 | int main( int argc, char *argv ) | 3 | FString genThing() |
4 | { | 4 | { |
5 | FString str("[] this won't be in there", 3); | 5 | FString bob; |
6 | 6 | bob.append("ab "); | |
7 | str.append("Hello"); | 7 | bob += "cd "; |
8 | str.append(" th"); | 8 | bob += "efg"; |
9 | str.append("ere."); | ||
10 | 9 | ||
11 | if( str == "[] Hello there." ) | 10 | printf("---bob------\n%08X: %s\n", (unsigned int)bob.c_str(), bob.c_str() ); |
12 | printf("1) check\n"); | 11 | return bob; |
12 | } | ||
13 | 13 | ||
14 | if( str != "[] Hello there. " ) | 14 | #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() ); |
15 | printf("2) check\n"); | 15 | int main( int argc, char *argv ) |
16 | { | ||
17 | FString str("th"); | ||
16 | 18 | ||
17 | if( str != "[] Hello there." ) | 19 | str.prepend("Hello "); |
18 | printf("3) failed\n"); | 20 | str.append("ere."); |
19 | else | ||
20 | printf("3) check\n"); | ||
21 | 21 | ||
22 | str += " How are you?"; | 22 | FString str2( str ); |
23 | pem; | ||
24 | str += " What's up?"; | ||
25 | pem; | ||
26 | str2 += " How are you?"; | ||
27 | pem; | ||
28 | str = str2; | ||
29 | pem; | ||
23 | 30 | ||
24 | str.prepend("Bob says: "); | 31 | str2 = genThing(); |
32 | pem; | ||
25 | 33 | ||
26 | printf("%s\n", str.c_str() ); | 34 | str = str2; |
35 | pem; | ||
27 | } | 36 | } |
28 | 37 | ||