From 937d960d2677c87ac6d68dc5445be115ac001d3e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 29 Jun 2006 05:50:44 +0000 Subject: 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 --- src/unit/xml/xml.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/unit/xml/xml.cpp (limited to 'src/unit/xml') 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 @@ +#include +#include +#include +#include +#include + +#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 ) + + TEST_ADD( XmlCoreTestSuite::entityBuiltin01 ) + + TEST_ADD( XmlCoreTestSuite::entityDoc01 ) + } + +private: + void badXml01() + { + TEST_THROWS( XmlStringReader r(""), XmlException & ); + } + + void badXml02() + { + TEST_THROWS( XmlStringReader r(""), XmlException & ); + } + + void badXml03() + { + TEST_THROWS( XmlStringReader r("><&'""); + TEST_ASSERT( strcmp( r.getRoot()->getContent(), "><&\'\"" ) == 0 ); + } + + void entityDoc01() + { + XmlStringReader r(""&name;""); + TEST_ASSERT( strcmp( r.getRoot()->getContent(), "\"bob the man\"" ) == 0 ); + } +}; + +int main( int argc, char *argv[] ) +{ + Test::TextOutput output( Test::TextOutput::Verbose ); + XmlCoreTestSuite ts; + return ts.run( output ) ? EXIT_SUCCESS : EXIT_FAILURE; +} + -- cgit v1.2.3