summaryrefslogtreecommitdiff
path: root/src/unit/xml.cpp
blob: 559b2f4d96a364d2c46cf35710a032042db4c0b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cpptest.h>
#include <string.h>

#include "xmlstringreader.h"
#include "xmlexception.h"

class XmlCoreTestSuite : public Test::Suite
{
public:
	XmlCoreTestSuite()
	{
		TEST_ADD( XmlCoreTestSuite::badXml01 )
		TEST_ADD( XmlCoreTestSuite::badXml02 )
		TEST_ADD( XmlCoreTestSuite::badXml03 )
	}
	
private:
	void badXml01()
	{
		TEST_THROWS( XmlStringReader r("<hello></bye>"), XmlException & );
	}
	
	void badXml02()
	{
		TEST_THROWS( XmlStringReader r("<hello>"), XmlException & );
	}

	void badXml03()
	{
		TEST_THROWS( XmlStringReader r("<hello param=\"stuff?"), XmlException & );
	}
};

int main( int argc, char *argv[] )
{
	Test::TextOutput output( Test::TextOutput::Verbose );
	XmlCoreTestSuite ts;
	return ts.run( output ) ? EXIT_SUCCESS : EXIT_FAILURE;
}