mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-29 08:36:45 +01:00
Added tests for preceding and preceding-sibling
This commit is contained in:
parent
2cf6d009bf
commit
9cbe2c1621
1 changed files with 64 additions and 2 deletions
|
@ -188,8 +188,62 @@ public:
|
||||||
assertEquals(2, nodes.asNodeSet().size());
|
assertEquals(2, nodes.asNodeSet().size());
|
||||||
} // testFollowing3
|
} // testFollowing3
|
||||||
|
|
||||||
// FOLLOWING_SIBLING
|
void testPreceding1()
|
||||||
// FOLLOWING
|
{
|
||||||
|
extraSetUp();
|
||||||
|
XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("/root/node()[last()]/preceding::node()"), document_);
|
||||||
|
assertEquals(4, nodes.asNodeSet().size());
|
||||||
|
} // testPreceding1
|
||||||
|
|
||||||
|
void testPreceding2()
|
||||||
|
{
|
||||||
|
extraSetUp();
|
||||||
|
XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("/root/node()[last()]/preceding::text()"), document_);
|
||||||
|
assertEquals(2, nodes.asNodeSet().size());
|
||||||
|
} // testPreceding2
|
||||||
|
|
||||||
|
void testPreceding3()
|
||||||
|
{
|
||||||
|
extraSetUp();
|
||||||
|
XPathValue_t node = parser_.evaluate(SA::construct_from_utf8("/root/node()[last()]/preceding::text()[1]"), document_);
|
||||||
|
assertEquals("fourfive", node.asString());
|
||||||
|
} // testPreceding3
|
||||||
|
|
||||||
|
void testPreceding4()
|
||||||
|
{
|
||||||
|
extraSetUp();
|
||||||
|
XPathValue_t node = parser_.evaluate(SA::construct_from_utf8("/root/node()[last()]/preceding::text()[2]"), document_);
|
||||||
|
assertEquals("onetwothree", node.asString());
|
||||||
|
} // testPreceding4
|
||||||
|
|
||||||
|
void testPrecedingSibling1()
|
||||||
|
{
|
||||||
|
extraSetUp();
|
||||||
|
XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("/root/node()[last()]/preceding-sibling::node()"), document_);
|
||||||
|
assertEquals(4, nodes.asNodeSet().size());
|
||||||
|
} // testPrecedingSibling1
|
||||||
|
|
||||||
|
void testPrecedingSibling2()
|
||||||
|
{
|
||||||
|
extraSetUp();
|
||||||
|
XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("/root/node()[last()]/preceding-sibling::text()"), document_);
|
||||||
|
assertEquals(2, nodes.asNodeSet().size());
|
||||||
|
} // testPrecedingSibling2
|
||||||
|
|
||||||
|
void testPrecedingSibling3()
|
||||||
|
{
|
||||||
|
extraSetUp();
|
||||||
|
XPathValue_t node = parser_.evaluate(SA::construct_from_utf8("/root/node()[last()]/preceding-sibling::text()[1]"), document_);
|
||||||
|
assertEquals("fourfive", node.asString());
|
||||||
|
} // testPrecedingSibling3
|
||||||
|
|
||||||
|
void testPrecedingSibling4()
|
||||||
|
{
|
||||||
|
extraSetUp();
|
||||||
|
XPathValue_t node = parser_.evaluate(SA::construct_from_utf8("/root/node()[last()]/preceding-sibling::text()[2]"), document_);
|
||||||
|
assertEquals("onetwothree", node.asString());
|
||||||
|
} // testPrecedingSibling4
|
||||||
|
|
||||||
// PRECEDING
|
// PRECEDING
|
||||||
// PRECEDING_SIBLING
|
// PRECEDING_SIBLING
|
||||||
}; // class TextNodeTest
|
}; // class TextNodeTest
|
||||||
|
@ -219,6 +273,14 @@ TestSuite* TextNodeTest_suite()
|
||||||
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testFollowing1", &TextNodeTest<string_type, string_adaptor>::testFollowing1));
|
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testFollowing1", &TextNodeTest<string_type, string_adaptor>::testFollowing1));
|
||||||
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testFollowing2", &TextNodeTest<string_type, string_adaptor>::testFollowing2));
|
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testFollowing2", &TextNodeTest<string_type, string_adaptor>::testFollowing2));
|
||||||
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testFollowing3", &TextNodeTest<string_type, string_adaptor>::testFollowing3));
|
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testFollowing3", &TextNodeTest<string_type, string_adaptor>::testFollowing3));
|
||||||
|
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testPreceding1", &TextNodeTest<string_type, string_adaptor>::testPreceding1));
|
||||||
|
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testPreceding2", &TextNodeTest<string_type, string_adaptor>::testPreceding2));
|
||||||
|
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testPreceding3", &TextNodeTest<string_type, string_adaptor>::testPreceding3));
|
||||||
|
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testPreceding4", &TextNodeTest<string_type, string_adaptor>::testPreceding4));
|
||||||
|
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testPrecedingSibling1", &TextNodeTest<string_type, string_adaptor>::testPrecedingSibling1));
|
||||||
|
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testPrecedingSibling2", &TextNodeTest<string_type, string_adaptor>::testPrecedingSibling2));
|
||||||
|
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testPrecedingSibling3", &TextNodeTest<string_type, string_adaptor>::testPrecedingSibling3));
|
||||||
|
suiteOfTests->addTest(new TestCaller<TextNodeTest<string_type, string_adaptor> >("testPrecedingSibling4", &TextNodeTest<string_type, string_adaptor>::testPrecedingSibling4));
|
||||||
|
|
||||||
return suiteOfTests;
|
return suiteOfTests;
|
||||||
} // TextNodeTest
|
} // TextNodeTest
|
||||||
|
|
Loading…
Add table
Reference in a new issue