From 9a89fde9502492ca74587367967e9cccac296098 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Tue, 3 Jun 2014 23:15:15 +0200
Subject: [PATCH] fix regexp tests

---
 alib2/test-src/regexp/RegExpTest.cpp | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/alib2/test-src/regexp/RegExpTest.cpp b/alib2/test-src/regexp/RegExpTest.cpp
index 7d45f528a8..461c82185f 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 );
-- 
GitLab