From 956249269ce519edd058fa0332891a09b447dabf Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Fri, 25 Apr 2014 08:33:47 +0200
Subject: [PATCH] one new tests

---
 alib2/test-src/regexp/RegExpTest.cpp | 35 ++++++++++++++++++++++++++++
 alib2/test-src/regexp/RegExpTest.h   |  2 ++
 2 files changed, 37 insertions(+)

diff --git a/alib2/test-src/regexp/RegExpTest.cpp b/alib2/test-src/regexp/RegExpTest.cpp
index e99b479dc6..87efaccc7a 100644
--- a/alib2/test-src/regexp/RegExpTest.cpp
+++ b/alib2/test-src/regexp/RegExpTest.cpp
@@ -1,7 +1,14 @@
+#include <list>
 #include "RegExpTest.h"
+
+#include "sax/SaxParseInterface.h"
+#include "sax/SaxPrintInterface.h"
+
 #include "regexp/RegExp.h"
 #include "regexp/RegExpFromStringParser.h"
 #include "regexp/RegExpToStringComposer.h"
+#include "regexp/RegExpFromXMLParser.h"
+#include "regexp/RegExpToXMLComposer.h"
 
 CPPUNIT_TEST_SUITE_REGISTRATION( RegExpTest );
 
@@ -25,3 +32,31 @@ void RegExpTest::testEqual() {
   
   CPPUNIT_ASSERT( regexp == regexp2 );
 }
+
+void RegExpTest::testXMLParser() {
+  
+  regexp::RegExp regexp(
+	regexp::Alternation(
+		regexp::Concatenation(
+			regexp::RegExpSymbol("1"),
+			regexp::RegExpSymbol("2")
+				     ),
+		regexp::Iteration(
+			regexp::RegExpSymbol("1")
+				 )
+			   )
+		       );
+      
+  regexp::RegExpToXMLComposer composer;
+  std::list<sax::Token> tokens = composer.compose(regexp);
+  std::string tmp;
+  sax::SaxPrintInterface::printMemory(tmp, tokens);
+  
+  std::list<sax::Token> tokens2 = composer.compose(regexp);
+  sax::SaxParseInterface::parseMemory(tmp, tokens2);
+  regexp::RegExpFromXMLParser parser;
+  regexp::RegExp regexp2 = parser.parse(tokens2);
+  
+  CPPUNIT_ASSERT( regexp == regexp2 );
+  
+}
\ No newline at end of file
diff --git a/alib2/test-src/regexp/RegExpTest.h b/alib2/test-src/regexp/RegExpTest.h
index 6c343586d4..c7c19a84a8 100644
--- a/alib2/test-src/regexp/RegExpTest.h
+++ b/alib2/test-src/regexp/RegExpTest.h
@@ -7,6 +7,7 @@ class RegExpTest : public CppUnit::TestFixture
 {
   CPPUNIT_TEST_SUITE( RegExpTest );
   CPPUNIT_TEST( testEqual );
+  CPPUNIT_TEST( testXMLParser );
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -14,6 +15,7 @@ public:
   void tearDown();
 
   void testEqual();
+  void testXMLParser();
 };
 
 #endif  // REG_EXP_TEST_H_
-- 
GitLab