unified NodeTest tests

This commit is contained in:
jez_higgins 2005-10-12 08:33:13 +00:00
parent 3d34346953
commit ba55966762
8 changed files with 283 additions and 555 deletions

View file

@ -30,7 +30,7 @@ int main(int argc, char** argv)
runner.addTest("RelationalTest", RelationalTest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.addTest("LogicalTest", LogicalTest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.addTest("AxisEnumeratorTest", AxisEnumeratorTest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.addTest("NodeTestTest", NodeTestTest_suite());
runner.addTest("NodeTestTest", NodeTestTest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.addTest("StepTest", StepTest_suite());
runner.addTest("ParseTest", ParseTest_suite());
runner.addTest("ExecuteTest", ExecuteTest_suite());

View file

@ -1,262 +0,0 @@
#ifdef _MSC_VER
#pragma warning(disable: 4786 4250 4503 4224 4180)
#endif
#include "../CppUnit/framework/TestCase.h"
#include "../CppUnit/framework/TestSuite.h"
#include "../CppUnit/framework/TestCaller.h"
#include <XPath/XPath.hpp>
#include <DOM/Simple/DOMImplementation.h>
using namespace Arabica::XPath;
class NodeTestTest : public TestCase
{
DOM::DOMImplementation<std::string> factory_;
DOM::Document<std::string> document_;
DOM::Element<std::string> root_;
DOM::Element<std::string> element1_;
DOM::Element<std::string> element2_;
DOM::Element<std::string> element3_;
DOM::Attr<std::string> attr_;
DOM::Text<std::string> text_;
DOM::Comment<std::string> comment_;
DOM::ProcessingInstruction<std::string> processingInstruction_;
public:
NodeTestTest(const std::string& name) : TestCase(name)
{
} // NodeTestTest
void setUp()
{
factory_ = SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
document_ = factory_.createDocument("", "root", 0);
root_ = document_.getDocumentElement();
element1_ = document_.createElement("child1");
element2_ = document_.createElement("child2");
element3_ = document_.createElement("child3");
element1_.setAttribute("one", "1");
element2_.setAttribute("one", "1");
element2_.setAttribute("two", "1");
element2_.setAttribute("three", "1");
element2_.setAttribute("four", "1");
text_ = document_.createTextNode("data");
comment_ = document_.createComment("comment");
processingInstruction_ = document_.createProcessingInstruction("target", "data");
element2_.appendChild(text_);
element2_.appendChild(document_.createElement("spinkle"));
element2_.appendChild(comment_);
element2_.appendChild(processingInstruction_);
attr_ = element1_.getAttributeNode("one");
root_.appendChild(element1_);
root_.appendChild(element2_);
root_.appendChild(element3_);
} // setUp
void test1()
{
impl::AnyNodeTest<std::string> test;
assertTrue(test(element1_));
assertTrue(test(element2_));
assertTrue(test(root_));
assertTrue(test(attr_));
assertTrue(test(document_));
assertTrue(test(text_));
assertTrue(test(comment_));
assertTrue(test(processingInstruction_));
} // test1
void test2()
{
impl::NameNodeTest<std::string, Arabica::default_string_adaptor<std::string> > test("child1");
assertTrue(test(element1_));
assertTrue(!test(element2_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test2
void test3()
{
impl::NameNodeTest<std::string, Arabica::default_string_adaptor<std::string> > test("one");
assertTrue(!test(element1_));
assertTrue(!test(element2_));
assertTrue(!test(root_));
assertTrue(test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test3
void test4()
{
impl::TextNodeTest<std::string> test;
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test4
void test5()
{
impl::CommentNodeTest<std::string> test;
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(test(comment_));
assertTrue(!test(processingInstruction_));
} // test5
void test6()
{
impl::ProcessingInstructionNodeTest<std::string, Arabica::default_string_adaptor<std::string> > test;
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(test(processingInstruction_));
} // test6
void test7()
{
impl::ProcessingInstructionNodeTest<std::string, Arabica::default_string_adaptor<std::string> > test("fruity");
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test7
void test8()
{
impl::ProcessingInstructionNodeTest<std::string, Arabica::default_string_adaptor<std::string> > test("target");
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(test(processingInstruction_));
} // test8
void test9()
{
impl::StarNodeTest<std::string> test;
AxisEnumerator<std::string, Arabica::default_string_adaptor<std::string> > e(element2_, CHILD);
assertTrue(!test(*e));
++e;
assertTrue(test(*e));
++e;
assertTrue(!test(*e));
++e;
assertTrue(!test(*e));
} // test9
void test10()
{
impl::QNameNodeTest<std::string> test("http://example.com/test", "one");
assertTrue(!test(element1_));
assertTrue(!test(element2_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test10
void test11()
{
impl::QNameNodeTest<std::string> test("http://example.com/test", "one");
DOM::Element<std::string> e1_ = document_.createElementNS("http://example.com/test", "ns:one");
DOM::Element<std::string> e2_ = document_.createElementNS("http://example.com/test", "ttt:one");
DOM::Element<std::string> e3_ = document_.createElementNS("http://example.com/test", "ns:two");
DOM::Element<std::string> e4_ = document_.createElementNS("http://example.com/test", "ttt:two");
DOM::Element<std::string> e5_ = document_.createElementNS("http://example.com/ssss", "ns:one");
DOM::Element<std::string> e6_ = document_.createElementNS("http://example.com/eeee", "ttt:one");
assertTrue(test(e1_));
assertTrue(test(e2_));
assertTrue(!test(e3_));
assertTrue(!test(e4_));
assertTrue(!test(e5_));
assertTrue(!test(e6_));
} // test11
void test12()
{
impl::QStarNodeTest<std::string> test("http://example.com/test");
DOM::Element<std::string> e1_ = document_.createElementNS("http://example.com/test", "ns:one");
DOM::Element<std::string> e2_ = document_.createElementNS("http://example.com/test", "ttt:one");
DOM::Element<std::string> e3_ = document_.createElementNS("http://example.com/test", "ns:two");
DOM::Element<std::string> e4_ = document_.createElementNS("http://example.com/test", "ttt:two");
DOM::Element<std::string> e5_ = document_.createElementNS("http://example.com/ssss", "ns:one");
DOM::Element<std::string> e6_ = document_.createElementNS("http://example.com/eeee", "ttt:one");
assertTrue(test(e1_));
assertTrue(test(e2_));
assertTrue(test(e3_));
assertTrue(test(e4_));
assertTrue(!test(e5_));
assertTrue(!test(e6_));
} // test12
}; // class NodeTestTest
TestSuite* NodeTestTest_suite()
{
TestSuite* suiteOfTests = new TestSuite;
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test1", &NodeTestTest::test1));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test2", &NodeTestTest::test2));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test3", &NodeTestTest::test3));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test4", &NodeTestTest::test4));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test5", &NodeTestTest::test5));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test6", &NodeTestTest::test6));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test7", &NodeTestTest::test7));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test8", &NodeTestTest::test8));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test9", &NodeTestTest::test9));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test10", &NodeTestTest::test10));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test11", &NodeTestTest::test11));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test12", &NodeTestTest::test12));
return suiteOfTests;
} // NodeTestTest_suite

View file

@ -1,6 +1,284 @@
#ifndef NODE_TEST_TEST_H
#define NODE_TEST_TEST_H
TestSuite* NodeTestTest_suite();
#include "../CppUnit/framework/TestCase.h"
#include "../CppUnit/framework/TestSuite.h"
#include "../CppUnit/framework/TestCaller.h"
#include <XPath/XPath.hpp>
#include <DOM/Simple/DOMImplementation.h>
template<class string_type, class string_adaptor>
class NodeTestTest : public TestCase
{
DOM::DOMImplementation<string_type> factory_;
DOM::Document<string_type> document_;
DOM::Element<string_type> root_;
DOM::Element<string_type> element1_;
DOM::Element<string_type> element2_;
DOM::Element<string_type> element3_;
DOM::Attr<string_type> attr_;
DOM::Text<string_type> text_;
DOM::Comment<string_type> comment_;
DOM::ProcessingInstruction<string_type> processingInstruction_;
typedef string_adaptor SA;
public:
NodeTestTest(const std::string& name) : TestCase(name)
{
} // NodeTestTest
void setUp()
{
factory_ = SimpleDOM::DOMImplementation<string_type>::getDOMImplementation();
document_ = factory_.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8("root"), 0);
root_ = document_.getDocumentElement();
element1_ = document_.createElement(SA::construct_from_utf8("child1"));
element2_ = document_.createElement(SA::construct_from_utf8("child2"));
element3_ = document_.createElement(SA::construct_from_utf8("child3"));
element1_.setAttribute(SA::construct_from_utf8("one"), SA::construct_from_utf8("1"));
element2_.setAttribute(SA::construct_from_utf8("one"), SA::construct_from_utf8("1"));
element2_.setAttribute(SA::construct_from_utf8("two"), SA::construct_from_utf8("1"));
element2_.setAttribute(SA::construct_from_utf8("three"), SA::construct_from_utf8("1"));
element2_.setAttribute(SA::construct_from_utf8("four"), SA::construct_from_utf8("1"));
text_ = document_.createTextNode(SA::construct_from_utf8("data"));
comment_ = document_.createComment(SA::construct_from_utf8("comment"));
processingInstruction_ = document_.createProcessingInstruction(SA::construct_from_utf8("target"), SA::construct_from_utf8("data"));
element2_.appendChild(text_);
element2_.appendChild(document_.createElement(SA::construct_from_utf8("spinkle")));
element2_.appendChild(comment_);
element2_.appendChild(processingInstruction_);
attr_ = element1_.getAttributeNode(SA::construct_from_utf8("one"));
root_.appendChild(element1_);
root_.appendChild(element2_);
root_.appendChild(element3_);
} // setUp
void test1()
{
using namespace Arabica::XPath;
impl::AnyNodeTest<string_type> test;
assertTrue(test(element1_));
assertTrue(test(element2_));
assertTrue(test(root_));
assertTrue(test(attr_));
assertTrue(test(document_));
assertTrue(test(text_));
assertTrue(test(comment_));
assertTrue(test(processingInstruction_));
} // test1
void test2()
{
using namespace Arabica::XPath;
impl::NameNodeTest<string_type, string_adaptor> test(SA::construct_from_utf8("child1"));
assertTrue(test(element1_));
assertTrue(!test(element2_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test2
void test3()
{
using namespace Arabica::XPath;
impl::NameNodeTest<string_type, string_adaptor> test(SA::construct_from_utf8("one"));
assertTrue(!test(element1_));
assertTrue(!test(element2_));
assertTrue(!test(root_));
assertTrue(test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test3
void test4()
{
using namespace Arabica::XPath;
impl::TextNodeTest<string_type> test;
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test4
void test5()
{
using namespace Arabica::XPath;
impl::CommentNodeTest<string_type> test;
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(test(comment_));
assertTrue(!test(processingInstruction_));
} // test5
void test6()
{
using namespace Arabica::XPath;
impl::ProcessingInstructionNodeTest<string_type, string_adaptor> test;
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(test(processingInstruction_));
} // test6
void test7()
{
using namespace Arabica::XPath;
impl::ProcessingInstructionNodeTest<string_type, string_adaptor> test(SA::construct_from_utf8("fruity"));
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test7
void test8()
{
using namespace Arabica::XPath;
impl::ProcessingInstructionNodeTest<string_type, string_adaptor> test(SA::construct_from_utf8("target"));
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(test(processingInstruction_));
} // test8
void test9()
{
using namespace Arabica::XPath;
impl::StarNodeTest<string_type> test;
AxisEnumerator<string_type, string_adaptor> e(element2_, CHILD);
assertTrue(!test(*e));
++e;
assertTrue(test(*e));
++e;
assertTrue(!test(*e));
++e;
assertTrue(!test(*e));
} // test9
void test10()
{
using namespace Arabica::XPath;
impl::QNameNodeTest<string_type> test(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("one"));
assertTrue(!test(element1_));
assertTrue(!test(element2_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test10
void test11()
{
using namespace Arabica::XPath;
impl::QNameNodeTest<string_type> test(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("one"));
DOM::Element<string_type> e1_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("ns:one"));
DOM::Element<string_type> e2_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("ttt:one"));
DOM::Element<string_type> e3_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("ns:two"));
DOM::Element<string_type> e4_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("ttt:two"));
DOM::Element<string_type> e5_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/ssss"),
SA::construct_from_utf8("ns:one"));
DOM::Element<string_type> e6_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/eeee"),
SA::construct_from_utf8("ttt:one"));
assertTrue(test(e1_));
assertTrue(test(e2_));
assertTrue(!test(e3_));
assertTrue(!test(e4_));
assertTrue(!test(e5_));
assertTrue(!test(e6_));
} // test11
void test12()
{
using namespace Arabica::XPath;
impl::QStarNodeTest<string_type> test(SA::construct_from_utf8("http://example.com/test"));
DOM::Element<string_type> e1_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ns:one"));
DOM::Element<string_type> e2_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ttt:one"));
DOM::Element<string_type> e3_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ns:two"));
DOM::Element<string_type> e4_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ttt:two"));
DOM::Element<string_type> e5_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/ssss"), SA::construct_from_utf8("ns:one"));
DOM::Element<string_type> e6_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/eeee"), SA::construct_from_utf8("ttt:one"));
assertTrue(test(e1_));
assertTrue(test(e2_));
assertTrue(test(e3_));
assertTrue(test(e4_));
assertTrue(!test(e5_));
assertTrue(!test(e6_));
} // test12
}; // class NodeTestTest
template<class string_type, class string_adaptor>
TestSuite* NodeTestTest_suite()
{
TestSuite* suiteOfTests = new TestSuite;
suiteOfTests->addTest(new TestCaller<NodeTestTest<string_type, string_adaptor> >("test1", &NodeTestTest<string_type, string_adaptor>::test1));
suiteOfTests->addTest(new TestCaller<NodeTestTest<string_type, string_adaptor> >("test2", &NodeTestTest<string_type, string_adaptor>::test2));
suiteOfTests->addTest(new TestCaller<NodeTestTest<string_type, string_adaptor> >("test3", &NodeTestTest<string_type, string_adaptor>::test3));
suiteOfTests->addTest(new TestCaller<NodeTestTest<string_type, string_adaptor> >("test4", &NodeTestTest<string_type, string_adaptor>::test4));
suiteOfTests->addTest(new TestCaller<NodeTestTest<string_type, string_adaptor> >("test5", &NodeTestTest<string_type, string_adaptor>::test5));
suiteOfTests->addTest(new TestCaller<NodeTestTest<string_type, string_adaptor> >("test6", &NodeTestTest<string_type, string_adaptor>::test6));
suiteOfTests->addTest(new TestCaller<NodeTestTest<string_type, string_adaptor> >("test7", &NodeTestTest<string_type, string_adaptor>::test7));
suiteOfTests->addTest(new TestCaller<NodeTestTest<string_type, string_adaptor> >("test8", &NodeTestTest<string_type, string_adaptor>::test8));
suiteOfTests->addTest(new TestCaller<NodeTestTest<string_type, string_adaptor> >("test9", &NodeTestTest<string_type, string_adaptor>::test9));
suiteOfTests->addTest(new TestCaller<NodeTestTest<string_type, string_adaptor> >("test10", &NodeTestTest<string_type, string_adaptor>::test10));
suiteOfTests->addTest(new TestCaller<NodeTestTest<string_type, string_adaptor> >("test11", &NodeTestTest<string_type, string_adaptor>::test11));
suiteOfTests->addTest(new TestCaller<NodeTestTest<string_type, string_adaptor> >("test12", &NodeTestTest<string_type, string_adaptor>::test12));
return suiteOfTests;
} // NodeTestTest_suite
#endif

View file

@ -131,9 +131,6 @@
<File
RelativePath=".\main.cpp">
</File>
<File
RelativePath=".\node_test_test.cpp">
</File>
<File
RelativePath=".\parse_test.cpp">
</File>

View file

@ -13,7 +13,7 @@
#include "../XPath/relational_test.hpp"
#include "../XPath/logical_test.hpp"
#include "../XPath/axis_enumerator_test.hpp"
#include "node_test_test.hpp"
#include "../XPath/node_test_test.hpp"
#include "step_test.hpp"
#include "parse_test.hpp"
#include "execute_test.hpp"
@ -34,7 +34,7 @@ int main(int argc, char** argv)
runner.addTest("RelationalTest", RelationalTest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
runner.addTest("LogicalTest", LogicalTest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
runner.addTest("AxisEnumeratorTest", AxisEnumeratorTest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
runner.addTest("NodeTestTest", NodeTestTest_suite());
runner.addTest("NodeTestTest", NodeTestTest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
runner.addTest("StepTest", StepTest_suite());
runner.addTest("ParseTest", ParseTest_suite());
runner.addTest("ExecuteTest", ExecuteTest_suite());

View file

@ -1,276 +0,0 @@
#ifdef _MSC_VER
#pragma warning(disable: 4786 4250 4503 4224 4180)
#endif
#include "../CppUnit/framework/TestCase.h"
#include "../CppUnit/framework/TestSuite.h"
#include "../CppUnit/framework/TestCaller.h"
#include "../silly_string/silly_string.hpp"
#include <XPath/XPath.hpp>
#include <DOM/Simple/DOMImplementation.h>
// let's see if this crazy gizmo really works
// and define a default_string_adaptor specialisation
template<> class Arabica::default_string_adaptor<silly_string> : public silly_string_adaptor { };
using namespace Arabica::XPath;
class NodeTestTest : public TestCase
{
DOM::DOMImplementation<silly_string> factory_;
DOM::Document<silly_string> document_;
DOM::Element<silly_string> root_;
DOM::Element<silly_string> element1_;
DOM::Element<silly_string> element2_;
DOM::Element<silly_string> element3_;
DOM::Attr<silly_string> attr_;
DOM::Text<silly_string> text_;
DOM::Comment<silly_string> comment_;
DOM::ProcessingInstruction<silly_string> processingInstruction_;
typedef silly_string_adaptor SA;
public:
NodeTestTest(const std::string& name) : TestCase(name)
{
} // NodeTestTest
void setUp()
{
factory_ = SimpleDOM::DOMImplementation<silly_string>::getDOMImplementation();
document_ = factory_.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8("root"), 0);
root_ = document_.getDocumentElement();
element1_ = document_.createElement(SA::construct_from_utf8("child1"));
element2_ = document_.createElement(SA::construct_from_utf8("child2"));
element3_ = document_.createElement(SA::construct_from_utf8("child3"));
element1_.setAttribute(SA::construct_from_utf8("one"), SA::construct_from_utf8("1"));
element2_.setAttribute(SA::construct_from_utf8("one"), SA::construct_from_utf8("1"));
element2_.setAttribute(SA::construct_from_utf8("two"), SA::construct_from_utf8("1"));
element2_.setAttribute(SA::construct_from_utf8("three"), SA::construct_from_utf8("1"));
element2_.setAttribute(SA::construct_from_utf8("four"), SA::construct_from_utf8("1"));
text_ = document_.createTextNode(SA::construct_from_utf8("data"));
comment_ = document_.createComment(SA::construct_from_utf8("comment"));
processingInstruction_ = document_.createProcessingInstruction(SA::construct_from_utf8("target"), SA::construct_from_utf8("data"));
element2_.appendChild(text_);
element2_.appendChild(document_.createElement(SA::construct_from_utf8("spinkle")));
element2_.appendChild(comment_);
element2_.appendChild(processingInstruction_);
attr_ = element1_.getAttributeNode(SA::construct_from_utf8("one"));
root_.appendChild(element1_);
root_.appendChild(element2_);
root_.appendChild(element3_);
} // setUp
void test1()
{
impl::AnyNodeTest<silly_string> test;
assertTrue(test(element1_));
assertTrue(test(element2_));
assertTrue(test(root_));
assertTrue(test(attr_));
assertTrue(test(document_));
assertTrue(test(text_));
assertTrue(test(comment_));
assertTrue(test(processingInstruction_));
} // test1
void test2()
{
impl::NameNodeTest<silly_string, Arabica::default_string_adaptor<silly_string> > test(SA::construct_from_utf8("child1"));
assertTrue(test(element1_));
assertTrue(!test(element2_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test2
void test3()
{
impl::NameNodeTest<silly_string, Arabica::default_string_adaptor<silly_string> > test(SA::construct_from_utf8("one"));
assertTrue(!test(element1_));
assertTrue(!test(element2_));
assertTrue(!test(root_));
assertTrue(test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test3
void test4()
{
impl::TextNodeTest<silly_string> test;
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test4
void test5()
{
impl::CommentNodeTest<silly_string> test;
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(test(comment_));
assertTrue(!test(processingInstruction_));
} // test5
void test6()
{
impl::ProcessingInstructionNodeTest<silly_string, Arabica::default_string_adaptor<silly_string> > test;
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(test(processingInstruction_));
} // test6
void test7()
{
impl::ProcessingInstructionNodeTest<silly_string, Arabica::default_string_adaptor<silly_string> > test(SA::construct_from_utf8("fruity"));
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test7
void test8()
{
impl::ProcessingInstructionNodeTest<silly_string, Arabica::default_string_adaptor<silly_string> > test(SA::construct_from_utf8("target"));
assertTrue(!test(element1_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(test(processingInstruction_));
} // test8
void test9()
{
impl::StarNodeTest<silly_string> test;
AxisEnumerator<silly_string, Arabica::default_string_adaptor<silly_string> > e(element2_, CHILD);
assertTrue(!test(*e));
++e;
assertTrue(test(*e));
++e;
assertTrue(!test(*e));
++e;
assertTrue(!test(*e));
} // test9
void test10()
{
impl::QNameNodeTest<silly_string> test(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("one"));
assertTrue(!test(element1_));
assertTrue(!test(element2_));
assertTrue(!test(root_));
assertTrue(!test(attr_));
assertTrue(!test(document_));
assertTrue(!test(text_));
assertTrue(!test(comment_));
assertTrue(!test(processingInstruction_));
} // test10
void test11()
{
impl::QNameNodeTest<silly_string> test(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("one"));
DOM::Element<silly_string> e1_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("ns:one"));
DOM::Element<silly_string> e2_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("ttt:one"));
DOM::Element<silly_string> e3_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("ns:two"));
DOM::Element<silly_string> e4_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("ttt:two"));
DOM::Element<silly_string> e5_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/ssss"),
SA::construct_from_utf8("ns:one"));
DOM::Element<silly_string> e6_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/eeee"),
SA::construct_from_utf8("ttt:one"));
assertTrue(test(e1_));
assertTrue(test(e2_));
assertTrue(!test(e3_));
assertTrue(!test(e4_));
assertTrue(!test(e5_));
assertTrue(!test(e6_));
} // test11
void test12()
{
impl::QStarNodeTest<silly_string> test(SA::construct_from_utf8("http://example.com/test"));
DOM::Element<silly_string> e1_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ns:one"));
DOM::Element<silly_string> e2_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ttt:one"));
DOM::Element<silly_string> e3_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ns:two"));
DOM::Element<silly_string> e4_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ttt:two"));
DOM::Element<silly_string> e5_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/ssss"), SA::construct_from_utf8("ns:one"));
DOM::Element<silly_string> e6_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/eeee"), SA::construct_from_utf8("ttt:one"));
assertTrue(test(e1_));
assertTrue(test(e2_));
assertTrue(test(e3_));
assertTrue(test(e4_));
assertTrue(!test(e5_));
assertTrue(!test(e6_));
} // test12
}; // class NodeTestTest
TestSuite* NodeTestTest_suite()
{
TestSuite* suiteOfTests = new TestSuite;
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test1", &NodeTestTest::test1));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test2", &NodeTestTest::test2));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test3", &NodeTestTest::test3));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test4", &NodeTestTest::test4));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test5", &NodeTestTest::test5));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test6", &NodeTestTest::test6));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test7", &NodeTestTest::test7));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test8", &NodeTestTest::test8));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test9", &NodeTestTest::test9));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test10", &NodeTestTest::test10));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test11", &NodeTestTest::test11));
suiteOfTests->addTest(new TestCaller<NodeTestTest>("test12", &NodeTestTest::test12));
return suiteOfTests;
} // NodeTestTest_suite

View file

@ -1,6 +0,0 @@
#ifndef NODE_TEST_TEST_H
#define NODE_TEST_TEST_H
TestSuite* NodeTestTest_suite();
#endif

View file

@ -131,9 +131,6 @@
<File
RelativePath=".\main.cpp">
</File>
<File
RelativePath=".\node_test_test.cpp">
</File>
<File
RelativePath=".\parse_test.cpp">
</File>
@ -161,7 +158,7 @@
RelativePath="..\XPath\logical_test.hpp">
</File>
<File
RelativePath=".\node_test_test.hpp">
RelativePath="..\XPath\node_test_test.hpp">
</File>
<File
RelativePath=".\parse_test.hpp">