summaryrefslogtreecommitdiff
path: root/src/unit/xml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/unit/xml.cpp')
-rw-r--r--src/unit/xml.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/unit/xml.cpp b/src/unit/xml.cpp
new file mode 100644
index 0000000..559b2f4
--- /dev/null
+++ b/src/unit/xml.cpp
@@ -0,0 +1,43 @@
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
20private:
21 void badXml01()
22 {
23 TEST_THROWS( XmlStringReader r("<hello></bye>"), XmlException & );
24 }
25
26 void badXml02()
27 {
28 TEST_THROWS( XmlStringReader r("<hello>"), XmlException & );
29 }
30
31 void badXml03()
32 {
33 TEST_THROWS( XmlStringReader r("<hello param=\"stuff?"), XmlException & );
34 }
35};
36
37int main( int argc, char *argv[] )
38{
39 Test::TextOutput output( Test::TextOutput::Verbose );
40 XmlCoreTestSuite ts;
41 return ts.run( output ) ? EXIT_SUCCESS : EXIT_FAILURE;
42}
43