diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/serialize.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/test/serialize.cpp b/src/test/serialize.cpp index 883be5e..e233704 100644 --- a/src/test/serialize.cpp +++ b/src/test/serialize.cpp | |||
@@ -1,24 +1,30 @@ | |||
1 | #include "serializerbinary.h" | 1 | #include "serializerbinary.h" |
2 | #include "staticstring.h" | ||
2 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include <string> | ||
3 | 5 | ||
4 | int main() | 6 | int main() |
5 | { | 7 | { |
6 | int32_t one; | 8 | int32_t one; |
7 | double two; | 9 | double two; |
8 | bool three; | 10 | bool three; |
11 | StaticString s("Test string!"); | ||
12 | std::string ss("Another test string"); | ||
9 | SerializerBinary ar("hello.dat", false); | 13 | SerializerBinary ar("hello.dat", false); |
10 | ar << (int)85; | 14 | ar << (int)85; |
11 | ar << (double)2.63434; | 15 | ar << (double)2.63434; |
12 | ar << false; | 16 | ar << false; |
17 | ar << ss; | ||
13 | ar.close(); | 18 | ar.close(); |
14 | 19 | ||
15 | one = 0; two = 0; three = true; | 20 | one = 0; two = 0; three = true; s = "die"; |
16 | 21 | ||
17 | SerializerBinary ar2("hello.dat", true); | 22 | SerializerBinary ar2("hello.dat", true); |
18 | ar2 >> one; | 23 | ar2 >> one; |
19 | ar2 >> two; | 24 | ar2 >> two; |
20 | ar2 >> three; | 25 | ar2 >> three; |
26 | ar2 >> s; | ||
21 | 27 | ||
22 | printf("we got %d - %f - %s\n", one, two, (three ? "true":"false")); | 28 | printf("we got %d - %f - %s - \"%s\"\n", one, two, (three ? "true":"false"), s.getString() ); |
23 | return 0; | 29 | return 0; |
24 | } | 30 | } |