#ifndef XPATHIC_LOGICAL_TEST_H #define XPATHIC_LOGICAL_TEST_H #include "../CppUnit/framework/TestCase.h" #include "../CppUnit/framework/TestSuite.h" #include "../CppUnit/framework/TestCaller.h" #include template class LogicalTest : public TestCase { public: LogicalTest(const std::string& name) : TestCase(name) { } // LogicalTest void setUp() { } // setUp void test1() { using namespace Arabica::XPath; XPathExpression orTest(new impl::OrOperator(new BoolValue(false), new BoolValue(false))); assertEquals(false, orTest.evaluateAsBool(dummy_)); } // test1 void test2() { using namespace Arabica::XPath; XPathExpression orTest(new impl::OrOperator(new BoolValue(false), new BoolValue(true))); assertEquals(true, orTest.evaluateAsBool(dummy_)); } // test2 void test3() { using namespace Arabica::XPath; XPathExpression orTest(new impl::OrOperator(new BoolValue(true), new BoolValue(false))); assertEquals(true, orTest.evaluateAsBool(dummy_)); } // test3 void test4() { using namespace Arabica::XPath; XPathExpression orTest(new impl::OrOperator(new BoolValue(true), new BoolValue(true))); assertEquals(true, orTest.evaluateAsBool(dummy_)); } // test4 void test5() { using namespace Arabica::XPath; XPathExpression andTest(new impl::AndOperator(new BoolValue(false), new BoolValue(false))); assertEquals(false, andTest.evaluateAsBool(dummy_)); } // test5 void test6() { using namespace Arabica::XPath; XPathExpression andTest(new impl::AndOperator(new BoolValue(false), new BoolValue(true))); assertEquals(false, andTest.evaluateAsBool(dummy_)); } // test6 void test7() { using namespace Arabica::XPath; XPathExpression andTest(new impl::AndOperator(new BoolValue(true), new BoolValue(false))); assertEquals(false, andTest.evaluateAsBool(dummy_)); } // test7 void test8() { using namespace Arabica::XPath; XPathExpression andTest(new impl::AndOperator(new BoolValue(true), new BoolValue(true))); assertEquals(true, andTest.evaluateAsBool(dummy_)); } // test8 private: Arabica::DOM::Node dummy_; }; // class LogicalTest template TestSuite* LogicalTest_suite() { TestSuite* tests = new TestSuite; tests->addTest(new TestCaller >("test1", &LogicalTest::test1)); tests->addTest(new TestCaller >("test2", &LogicalTest::test2)); tests->addTest(new TestCaller >("test3", &LogicalTest::test3)); tests->addTest(new TestCaller >("test4", &LogicalTest::test4)); tests->addTest(new TestCaller >("test5", &LogicalTest::test5)); tests->addTest(new TestCaller >("test6", &LogicalTest::test6)); tests->addTest(new TestCaller >("test7", &LogicalTest::test7)); tests->addTest(new TestCaller >("test8", &LogicalTest::test8)); return tests; } // LogicalTest_suite #endif