#ifndef UTILS_XML_STRINGS_HPP #define UTILS_XML_STRINGS_HPP #include using namespace Arabica::XML; template class NCNameTest : public TestCase { typedef string_adaptor SA; public: NCNameTest(std::string name) : TestCase(name) { } // NCNameTest void test1() { assertTrue(is_ncname(SA::construct_from_utf8("woo"))); } // test1 void test2() { assertTrue(is_ncname(SA::construct_from_utf8("WOO"))); } // test2 void test3() { assertFalse(is_ncname(SA::construct_from_utf8("???"))); } // test3 void test4() { assertTrue(is_ncname(SA::construct_from_utf8("a_b"))); } // test4 void test5() { assertFalse(is_ncname(SA::construct_from_utf8("a:b"))); } // test5 void test6() { assertFalse(is_ncname(SA::construct_from_utf8("xsl:foo"))); } // test6 }; // class NCNameTest template TestSuite* NCNameTest_suite() { typedef NCNameTest NCNT; TestSuite* suiteOfTests = new TestSuite(); suiteOfTests->addTest(new TestCaller("test1", &NCNT::test1)); suiteOfTests->addTest(new TestCaller("test2", &NCNT::test2)); suiteOfTests->addTest(new TestCaller("test3", &NCNT::test3)); suiteOfTests->addTest(new TestCaller("test4", &NCNT::test4)); suiteOfTests->addTest(new TestCaller("test5", &NCNT::test5)); suiteOfTests->addTest(new TestCaller("test6", &NCNT::test6)); return suiteOfTests; } // NCNT_suite template class QNameTest : public TestCase { typedef string_adaptor SA; public: QNameTest(std::string name) : TestCase(name) { } // QNameTest void test1() { assertTrue(is_qname(SA::construct_from_utf8("woo"))); } // test1 void test2() { assertTrue(is_qname(SA::construct_from_utf8("WOO"))); } // test2 void test3() { assertFalse(is_qname(SA::construct_from_utf8("???"))); } // test3 void test4() { assertTrue(is_qname(SA::construct_from_utf8("a_b"))); } // test4 void test5() { assertTrue(is_qname(SA::construct_from_utf8("a:b"))); } // test5 void test6() { assertTrue(is_qname(SA::construct_from_utf8("xsl:foo"))); } // test6 void test7() { assertFalse(is_qname(SA::construct_from_utf8(":foo"))); } // test7 void test8() { assertFalse(is_qname(SA::construct_from_utf8("foo:"))); } // test7 void test9() { assertFalse(is_qname(SA::construct_from_utf8("xsl::foo"))); } // test7 void test10() { assertFalse(is_qname(SA::construct_from_utf8("xsl:foo:"))); } // test7 void test11() { assertFalse(is_qname(SA::construct_from_utf8("$rr"))); } // test11 void test12() { assertFalse(is_qname(SA::construct_from_utf8("root/child"))); } // test12 }; // class QNameTest template TestSuite* QNameTest_suite() { typedef QNameTest QNT; TestSuite* suiteOfTests = new TestSuite(); suiteOfTests->addTest(new TestCaller("test1", &QNT::test1)); suiteOfTests->addTest(new TestCaller("test2", &QNT::test2)); suiteOfTests->addTest(new TestCaller("test3", &QNT::test3)); suiteOfTests->addTest(new TestCaller("test4", &QNT::test4)); suiteOfTests->addTest(new TestCaller("test5", &QNT::test5)); suiteOfTests->addTest(new TestCaller("test6", &QNT::test6)); suiteOfTests->addTest(new TestCaller("test7", &QNT::test7)); suiteOfTests->addTest(new TestCaller("test8", &QNT::test8)); suiteOfTests->addTest(new TestCaller("test9", &QNT::test9)); suiteOfTests->addTest(new TestCaller("test10", &QNT::test10)); suiteOfTests->addTest(new TestCaller("test11", &QNT::test11)); suiteOfTests->addTest(new TestCaller("test12", &QNT::test12)); return suiteOfTests; } // QNameTest_suite template TestSuite* XMLStringTest_suite() { TestSuite* suiteOfTests = new TestSuite(); suiteOfTests->addTest(NCNameTest_suite()); suiteOfTests->addTest(QNameTest_suite()); return suiteOfTests; } // XMLStringTest_suite #endif