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/xmlwritetest.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/xmlwritetest.cpp')
-rw-r--r-- | src/old/tests/xmlwritetest.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/old/tests/xmlwritetest.cpp b/src/old/tests/xmlwritetest.cpp new file mode 100644 index 0000000..a22d19d --- /dev/null +++ b/src/old/tests/xmlwritetest.cpp | |||
@@ -0,0 +1,48 @@ | |||
1 | #include "xmlfilewriter.h" | ||
2 | #include "xmlstringwriter.h" | ||
3 | #include "xmlstringreader.h" | ||
4 | |||
5 | void fillItIn( XmlWriter &w ) | ||
6 | { | ||
7 | w.addNode("thinglist"); | ||
8 | |||
9 | w.addNode("thing"); | ||
10 | w.addProperty("type", " ±î´<M-F6><M-F6>³¸®°êòì¯"); | ||
11 | |||
12 | w.addNode("id", "Klophin²³±¹¸·µ´äêíëã Staff", true ); | ||
13 | w.addNode("name", "Klophin Staff", true ); | ||
14 | w.addNode("durability", "0.01", true ); | ||
15 | w.addNode("size", "0.1", true ); | ||
16 | |||
17 | w.addNode("config"); | ||
18 | w.addNode("damage", "3d6+4", true ); | ||
19 | w.addNode("class", "melee", true ); | ||
20 | w.addNode("type", "bludgeon", true ); | ||
21 | w.addNode("damagedesc", "club/clubs", true ); | ||
22 | w.closeNode(); | ||
23 | |||
24 | w.closeNode(); | ||
25 | |||
26 | w.closeNode(); | ||
27 | } | ||
28 | |||
29 | int main() | ||
30 | { | ||
31 | printf("Testing XmlWriter...\n"); | ||
32 | |||
33 | //XmlStringReader *xsr = new XmlStringReader("<stuff/>"); | ||
34 | |||
35 | //printf("%08X\n%08X\n%08X\n", xsr, (XmlReader *)xsr, (XmlDocument *)xsr ); | ||
36 | |||
37 | //delete (XmlDocument *)xsr; | ||
38 | XmlFileWriter wf("test.xml", "\t"); | ||
39 | |||
40 | fillItIn( wf ); | ||
41 | |||
42 | XmlStringWriter ws("\t"); | ||
43 | fillItIn( ws ); | ||
44 | |||
45 | printf("Now the string version:\n\n%s\n", ws.getString().c_str() ); | ||
46 | |||
47 | return 0; | ||
48 | } | ||