diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-03-15 05:24:58 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-03-15 05:24:58 +0000 |
commit | cf847cc534a2a7ad06750c446028b7c6d126fe21 (patch) | |
tree | f4de1b9bcc261fe5dc758f13ee0b6d19b7ba5e27 /src/tests/fstring.cpp | |
parent | 46725741fc82866e41652dee7adeddf376fde618 (diff) | |
download | libbu++-cf847cc534a2a7ad06750c446028b7c6d126fe21.tar.gz libbu++-cf847cc534a2a7ad06750c446028b7c6d126fe21.tar.bz2 libbu++-cf847cc534a2a7ad06750c446028b7c6d126fe21.tar.xz libbu++-cf847cc534a2a7ad06750c446028b7c6d126fe21.zip |
Looks like FString is ready for general consumption, not too shabby.
Diffstat (limited to 'src/tests/fstring.cpp')
-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 | ||