added more text node tests

This commit is contained in:
jez 2008-09-16 08:31:30 +01:00
parent 57e8e9248e
commit 9c839505dd
2 changed files with 24 additions and 6 deletions

View file

@ -42,7 +42,7 @@ int main(int argc, const char* argv[])
std::cerr << "Could not parse XML source" << std::endl;
return 0;
} // if ...
document.normalize();
//document.normalize();
stylesheet->execute(document);
/*

View file

@ -55,7 +55,7 @@ public:
assertTrue(node == root_);
} // test1
void test2()
void testTextTest()
{
XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("/root/text()"), document_);
assertEquals(1, nodes.asNodeSet().size());
@ -79,12 +79,28 @@ public:
assertEquals("onetwothree", SA::asStdString(value));
} // test5
void test6()
void testNodeTest()
{
XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("/root/node()"), document_);
assertEquals(1, nodes.asNodeSet().size());
} // test6
} // testNodeTest
void testDescendantOrSelf()
{
XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("//text()"), document_);
assertEquals(1, nodes.asNodeSet().size());
} // testDescendantOrSelf
void testDescendant()
{
XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("/descendant::text()"), document_);
assertEquals(1, nodes.asNodeSet().size());
} // testDescendant
// FOLLOWING
// FOLLOWING_SIBLING
// PRECEDING
// PRECEDING_SIBLING
}; // class TextNodeTest
template<class string_type, class string_adaptor>
@ -93,11 +109,13 @@ TestSuite* TextNodeTest_suite()
TestSuite* suiteOfTests = new TestSuite;
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("test1", &TextNodeTest<string_type, string_adaptor>::test1));
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("test2", &TextNodeTest<string_type, string_adaptor>::test2));
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testTextTest", &TextNodeTest<string_type, string_adaptor>::testTextTest));
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("test3", &TextNodeTest<string_type, string_adaptor>::test3));
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("test4", &TextNodeTest<string_type, string_adaptor>::test4));
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("test5", &TextNodeTest<string_type, string_adaptor>::test5));
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("test6", &TextNodeTest<string_type, string_adaptor>::test6));
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testNodeTest", &TextNodeTest<string_type, string_adaptor>::testNodeTest));
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testDescendantOrSelf", &TextNodeTest<string_type, string_adaptor>::testDescendantOrSelf));
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testDescendant", &TextNodeTest<string_type, string_adaptor>::testDescendant));
return suiteOfTests;
} // TextNodeTest