diff --git a/alib2/test-src/regexp/RegExpTest.cpp b/alib2/test-src/regexp/RegExpTest.cpp index 7d45f528a872f569e433cf75503617afae02b426..461c82185f465efc8c956ec308481d889eb835d5 100644 --- a/alib2/test-src/regexp/RegExpTest.cpp +++ b/alib2/test-src/regexp/RegExpTest.cpp @@ -15,6 +15,7 @@ #include "label/StringLabel.h" #define CPPUNIT_IMPLY(x, y) CPPUNIT_ASSERT(!(x) || (y)) +#define CPPUNIT_EXCLUSIVE_OR(x, y) CPPUNIT_ASSERT((!(x) && (y)) || ((x) && !(y))) CPPUNIT_TEST_SUITE_REGISTRATION( RegExpTest ); @@ -56,7 +57,7 @@ void RegExpTest::testEqual() { regexp::RegExpToStringComposer composer; std::string output = composer.compose(regexp); - regexp::RegExpFromStringParser parser2(input); + regexp::RegExpFromStringParser parser2(output); regexp::RegExp regexp2 = parser2.parse(); CPPUNIT_ASSERT( regexp == regexp2 ); @@ -110,6 +111,29 @@ void RegExpTest::testOrder() { regexp::RegExp emp1(e1); regexp::RegExp eps1(e2); regexp::RegExp sym1(s1); + + bool tmp = alt1 < emp1; + bool tmp2 = emp1 < alt1; + + CPPUNIT_EXCLUSIVE_OR(alt1 < con1, con1 < alt1); + CPPUNIT_EXCLUSIVE_OR(alt1 < ite1, ite1 < alt1); + CPPUNIT_EXCLUSIVE_OR(alt1 < emp1, emp1 < alt1); + CPPUNIT_EXCLUSIVE_OR(alt1 < eps1, eps1 < alt1); + CPPUNIT_EXCLUSIVE_OR(alt1 < sym1, sym1 < alt1); + + CPPUNIT_EXCLUSIVE_OR(con1 < ite1, ite1 < con1); + CPPUNIT_EXCLUSIVE_OR(con1 < emp1, emp1 < con1); + CPPUNIT_EXCLUSIVE_OR(con1 < eps1, eps1 < con1); + CPPUNIT_EXCLUSIVE_OR(con1 < sym1, sym1 < con1); + + CPPUNIT_EXCLUSIVE_OR(ite1 < emp1, emp1 < ite1); + CPPUNIT_EXCLUSIVE_OR(ite1 < eps1, eps1 < ite1); + CPPUNIT_EXCLUSIVE_OR(ite1 < sym1, sym1 < ite1); + + CPPUNIT_EXCLUSIVE_OR(emp1 < eps1, eps1 < emp1); + CPPUNIT_EXCLUSIVE_OR(emp1 < sym1, sym1 < emp1); + + CPPUNIT_EXCLUSIVE_OR(eps1 < sym1, sym1 < eps1); CPPUNIT_IMPLY( alt1 < con1 && con1 < ite1, alt1 < ite1 ); CPPUNIT_IMPLY( alt1 < con1 && con1 < emp1, alt1 < emp1 );