mirror of
https://github.com/jezhiggins/arabica
synced 2024-12-26 21:58:39 +01:00
added more text node tests
This commit is contained in:
parent
57e8e9248e
commit
9c839505dd
2 changed files with 24 additions and 6 deletions
|
@ -42,7 +42,7 @@ int main(int argc, const char* argv[])
|
||||||
std::cerr << "Could not parse XML source" << std::endl;
|
std::cerr << "Could not parse XML source" << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
} // if ...
|
} // if ...
|
||||||
document.normalize();
|
//document.normalize();
|
||||||
stylesheet->execute(document);
|
stylesheet->execute(document);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
assertTrue(node == root_);
|
assertTrue(node == root_);
|
||||||
} // test1
|
} // test1
|
||||||
|
|
||||||
void test2()
|
void testTextTest()
|
||||||
{
|
{
|
||||||
XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("/root/text()"), document_);
|
XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("/root/text()"), document_);
|
||||||
assertEquals(1, nodes.asNodeSet().size());
|
assertEquals(1, nodes.asNodeSet().size());
|
||||||
|
@ -79,12 +79,28 @@ public:
|
||||||
assertEquals("onetwothree", SA::asStdString(value));
|
assertEquals("onetwothree", SA::asStdString(value));
|
||||||
} // test5
|
} // test5
|
||||||
|
|
||||||
void test6()
|
void testNodeTest()
|
||||||
{
|
{
|
||||||
XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("/root/node()"), document_);
|
XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("/root/node()"), document_);
|
||||||
assertEquals(1, nodes.asNodeSet().size());
|
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
|
}; // class TextNodeTest
|
||||||
|
|
||||||
template<class string_type, class string_adaptor>
|
template<class string_type, class string_adaptor>
|
||||||
|
@ -93,11 +109,13 @@ TestSuite* TextNodeTest_suite()
|
||||||
TestSuite* suiteOfTests = new TestSuite;
|
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> >("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> >("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> >("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> >("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;
|
return suiteOfTests;
|
||||||
} // TextNodeTest
|
} // TextNodeTest
|
||||||
|
|
Loading…
Reference in a new issue