#ifndef UTILS_QNAME_HPP #define UTILS_QNAME_HPP #include using namespace Arabica::XML; class QualifiedNameTest : public TestCase { public: QualifiedNameTest(const std::string& name) : TestCase(name) { } // QualifiedNameTest void testNcNameEquality() { QualifiedName q1("foo"); QualifiedName q2("foo"); assertTrue(q1 == q2); assertTrue(!(q1 != q2)); } // testNcNameEquality void testNcNameCopy() { QualifiedName q1("foo"); QualifiedName q2(q1); assertTrue(q1 == q2); assertTrue(!(q1 != q2)); } // testNcNameCopy void testNcNameAssignment() { QualifiedName q1("foo"); QualifiedName q2("bar"); assertFalse(q1 == q2); q2 = q1; assertTrue(q1 == q2); } // testNcNameAssignment void testNcClarkName() { QualifiedName q("bar"); assertEquals("bar", q.clarkName()); } // testNcClarkName void testEquality() { QualifiedName q1("foo", "bar", "http://test/"); QualifiedName q2("foo", "bar", "http://test/"); assertTrue(q1 == q2); assertTrue(!(q1 != q2)); // prefix is not significant QualifiedName q3("baz", "bar", "http://test/"); assertTrue(q1 == q3); assertTrue(!(q1 != q3)); } // testEquality void testCopy() { QualifiedName q1("foo", "bar", "http://test/"); QualifiedName q2(q1); assertTrue(q1 == q2); } // testCopy void testAssignment() { QualifiedName q1("foo", "bar", "http://test/"); QualifiedName q2("foo", "parp", "http://tst/"); assertTrue(q1 != q2); q2 = q1; assertTrue(q1 == q2); } // testAssignment void testClarkName() { QualifiedName q("foo", "bar", "http://test/"); assertEquals("{http://test/}bar", q.clarkName()); } // testClarkName }; // class QualifiedNameTest TestSuite* QualifiedNameTest_suite() { TestSuite* suiteOfTests = new TestSuite(); suiteOfTests->addTest(new TestCaller("testNcNameEquality", &QualifiedNameTest::testNcNameEquality)); suiteOfTests->addTest(new TestCaller("testNcNameCopy", &QualifiedNameTest::testNcNameCopy)); suiteOfTests->addTest(new TestCaller("testNcNameAssignment", &QualifiedNameTest::testNcNameAssignment)); suiteOfTests->addTest(new TestCaller("testNcClarkName", &QualifiedNameTest::testNcClarkName)); suiteOfTests->addTest(new TestCaller("testEquality", &QualifiedNameTest::testEquality)); suiteOfTests->addTest(new TestCaller("testCopy", &QualifiedNameTest::testCopy)); suiteOfTests->addTest(new TestCaller("testAssignment", &QualifiedNameTest::testAssignment)); suiteOfTests->addTest(new TestCaller("testClarkName", &QualifiedNameTest::testClarkName)); return suiteOfTests; } // QualifiedNameTest_suite #endif