Skip to content
Snippets Groups Projects
Commit 9a89fde9 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

fix regexp tests

parent 34489d9a
No related branches found
No related tags found
No related merge requests found
......@@ -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 );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment