diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-04-03 03:49:53 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-04-03 03:49:53 +0000 |
commit | f4c20290509d7ed3a8fd5304577e7a4cc0b9d974 (patch) | |
tree | 13cdf64f7cf134f397a7165b7a3fe0807e37026b /src/old/tests/fstring.cpp | |
parent | 74d4c8cd27334fc7204d5a8773deb3d424565778 (diff) | |
download | libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.gz libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.bz2 libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.xz libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.zip |
Ok, no code is left in src, it's all in src/old. We'll gradually move code back
into src as it's fixed and re-org'd. This includes tests, which, I may write a
unit test system into libbu++ just to make my life easier.
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 | |||