diff options
Diffstat (limited to 'src/old/tests/fstring.cpp')
-rw-r--r-- | src/old/tests/fstring.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/old/tests/fstring.cpp b/src/old/tests/fstring.cpp new file mode 100644 index 0000000..271738c --- /dev/null +++ b/src/old/tests/fstring.cpp | |||
@@ -0,0 +1,48 @@ | |||
1 | #include "hash.h" | ||
2 | #include "fstring.h" | ||
3 | |||
4 | FString genThing() | ||
5 | { | ||
6 | FString bob; | ||
7 | bob.append("ab "); | ||
8 | bob += "cd "; | ||
9 | bob += "efg"; | ||
10 | |||
11 | printf("---bob------\n%08X: %s\n", (unsigned int)bob.c_str(), bob.c_str() ); | ||
12 | return bob; | ||
13 | } | ||
14 | |||
15 | void thing( FString str ) | ||
16 | { | ||
17 | printf("Hey: %s\n", str.c_str() ); | ||
18 | } | ||
19 | |||
20 | #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() ); | ||
21 | int main( int argc, char *argv ) | ||
22 | { | ||
23 | FString str("th"); | ||
24 | |||
25 | str.prepend("Hello "); | ||
26 | str.append("ere."); | ||
27 | |||
28 | FString str2( str ); | ||
29 | pem; | ||
30 | str += " What's up?"; | ||
31 | pem; | ||
32 | str2 += " How are you?"; | ||
33 | pem; | ||
34 | str = str2; | ||
35 | pem; | ||
36 | |||
37 | str2 = genThing(); | ||
38 | pem; | ||
39 | |||
40 | str = str2; | ||
41 | pem; | ||
42 | |||
43 | thing( str2 ); | ||
44 | thing("test."); | ||
45 | |||
46 | printf("%d == %d\n", __calcHashCode( str ), __calcHashCode( str.c_str() ) ); | ||
47 | } | ||
48 | |||