diff options
Diffstat (limited to 'src/old/unit/xml/xml.cpp')
-rw-r--r-- | src/old/unit/xml/xml.cpp | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/src/old/unit/xml/xml.cpp b/src/old/unit/xml/xml.cpp deleted file mode 100644 index e4d779c..0000000 --- a/src/old/unit/xml/xml.cpp +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | #include <cstdlib> | ||
2 | #include <cstring> | ||
3 | #include <iostream> | ||
4 | #include <cpptest.h> | ||
5 | #include <string.h> | ||
6 | |||
7 | #include "xmlstringreader.h" | ||
8 | #include "xmlexception.h" | ||
9 | |||
10 | class XmlCoreTestSuite : public Test::Suite | ||
11 | { | ||
12 | public: | ||
13 | XmlCoreTestSuite() | ||
14 | { | ||
15 | TEST_ADD( XmlCoreTestSuite::badXml01 ) | ||
16 | TEST_ADD( XmlCoreTestSuite::badXml02 ) | ||
17 | TEST_ADD( XmlCoreTestSuite::badXml03 ) | ||
18 | |||
19 | TEST_ADD( XmlCoreTestSuite::entityBuiltin01 ) | ||
20 | |||
21 | TEST_ADD( XmlCoreTestSuite::entityDoc01 ) | ||
22 | } | ||
23 | |||
24 | private: | ||
25 | void badXml01() | ||
26 | { | ||
27 | TEST_THROWS( XmlStringReader r("<hello></bye>"), XmlException & ); | ||
28 | } | ||
29 | |||
30 | void badXml02() | ||
31 | { | ||
32 | TEST_THROWS( XmlStringReader r("<hello>"), XmlException & ); | ||
33 | } | ||
34 | |||
35 | void badXml03() | ||
36 | { | ||
37 | TEST_THROWS( XmlStringReader r("<hello param=\"stuff?"), XmlException & ); | ||
38 | } | ||
39 | |||
40 | void entityBuiltin01() | ||
41 | { | ||
42 | XmlStringReader r("<hello>><&'"</hello>"); | ||
43 | TEST_ASSERT( strcmp( r.getRoot()->getContent(), "><&\'\"" ) == 0 ); | ||
44 | } | ||
45 | |||
46 | void entityDoc01() | ||
47 | { | ||
48 | XmlStringReader r("<!ENTITY name \"bob the man\"><hello>"&name;"</hello>"); | ||
49 | TEST_ASSERT( strcmp( r.getRoot()->getContent(), "\"bob the man\"" ) == 0 ); | ||
50 | } | ||
51 | }; | ||
52 | |||
53 | int main( int argc, char *argv[] ) | ||
54 | { | ||
55 | Test::TextOutput output( Test::TextOutput::Verbose ); | ||
56 | XmlCoreTestSuite ts; | ||
57 | return ts.run( output ) ? EXIT_SUCCESS : EXIT_FAILURE; | ||
58 | } | ||
59 | |||