aboutsummaryrefslogtreecommitdiff
path: root/src/unit/xml
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-06-29 05:50:44 +0000
committerMike Buland <eichlan@xagasoft.com>2006-06-29 05:50:44 +0000
commit937d960d2677c87ac6d68dc5445be115ac001d3e (patch)
tree35b33aebb0cab5073fc0778f13f2425d3e18278f /src/unit/xml
parentdcd914665f6e8ea6ea4e648f7357f1c842273d87 (diff)
downloadlibbu++-937d960d2677c87ac6d68dc5445be115ac001d3e.tar.gz
libbu++-937d960d2677c87ac6d68dc5445be115ac001d3e.tar.bz2
libbu++-937d960d2677c87ac6d68dc5445be115ac001d3e.tar.xz
libbu++-937d960d2677c87ac6d68dc5445be115ac001d3e.zip
Completely switched over to the much simpler, nicer pymake. Things look great,
and the old Makefile may soon fall into disrepair. To use the old one, which should almost always be able to build at least thi library, call: make -f Makefile.legacy The new Makefile just calls pymake
Diffstat (limited to 'src/unit/xml')
-rw-r--r--src/unit/xml/xml.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/unit/xml/xml.cpp b/src/unit/xml/xml.cpp
new file mode 100644
index 0000000..e4d779c
--- /dev/null
+++ b/src/unit/xml/xml.cpp
@@ -0,0 +1,59 @@
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
10class XmlCoreTestSuite : public Test::Suite
11{
12public:
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
24private:
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>&gt;&lt;&amp;&apos;&quot;</hello>");
43 TEST_ASSERT( strcmp( r.getRoot()->getContent(), "><&\'\"" ) == 0 );
44 }
45
46 void entityDoc01()
47 {
48 XmlStringReader r("<!ENTITY name \"bob the man\"><hello>&quot;&name;&quot;</hello>");
49 TEST_ASSERT( strcmp( r.getRoot()->getContent(), "\"bob the man\"" ) == 0 );
50 }
51};
52
53int 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