diff --git a/alib2algo/test-src/regexp/simplify/RegExpOptimizeTest.cpp b/alib2algo/test-src/regexp/simplify/RegExpOptimizeTest.cpp
index a71c93872c37c3d16d3bd7a6caf2f8eee3224d80..b3b23fcfa233c1f5af5b3fb68b557998cbb08567 100644
--- a/alib2algo/test-src/regexp/simplify/RegExpOptimizeTest.cpp
+++ b/alib2algo/test-src/regexp/simplify/RegExpOptimizeTest.cpp
@@ -7,6 +7,8 @@
 
 #include <factory/StringDataFactory.hpp>
 
+#include <primitive/Character.h>
+
 #define CPPUNIT_IMPLY(x, y) CPPUNIT_ASSERT(!(x) || (y))
 #define CPPUNIT_EXCLUSIVE_OR(x, y) CPPUNIT_ASSERT((!(x) && (y)) || ((x) && !(y)))
 
@@ -65,3 +67,93 @@ void RegExpOptimizeTest::testOptimize() {
 
 }
 
+void RegExpOptimizeTest::testOptimizeTemplated() {
+	regexp::UnboundedRegExpSymbol < char > a ( 'a' );
+	regexp::UnboundedRegExpSymbol < char > b ( 'b' );
+//	regexp::UnboundedRegExpSymbol < char > z ( 'z' );
+
+	{
+		regexp::UnboundedRegExpAlternation < char > alt;
+		alt.appendElement ( a );
+		alt.appendElement ( a );
+
+		regexp::UnboundedRegExp < char > regexp ( regexp::UnboundedRegExpStructure < char > { alt } );
+
+		regexp::UnboundedRegExp < char > res = regexp::simplify::RegExpOptimize::optimize(regexp);
+
+		regexp::UnboundedRegExp < char > regexpRes( regexp::UnboundedRegExpStructure < char > { a } );
+
+		std::cout << res << std::endl;
+		std::cout << regexpRes << std::endl;
+
+		CPPUNIT_ASSERT ( regexpRes == res );
+	}
+	{
+		regexp::UnboundedRegExpAlternation < char > alt1;
+		alt1.appendElement ( a );
+		alt1.appendElement ( a );
+		regexp::UnboundedRegExpConcatenation < char > con1;
+		con1.appendElement ( alt1 );
+		con1.appendElement ( b );
+
+		regexp::UnboundedRegExpConcatenation < char > con2;
+		con2.appendElement ( regexp::UnboundedRegExpEmpty < char > { } );
+		con2.appendElement ( b );
+		regexp::UnboundedRegExpAlternation < char > alt2;
+		alt2.appendElement ( con2 );
+		alt2.appendElement ( a );
+
+		regexp::UnboundedRegExpConcatenation < char > con3;
+		con3.appendElement ( regexp::UnboundedRegExpEmpty < char > { } );
+		con3.appendElement ( a );
+		regexp::UnboundedRegExpAlternation < char > alt3;
+		alt3.appendElement ( con3 );
+		alt3.appendElement ( alt2 );
+
+		regexp::UnboundedRegExpConcatenation < char > con4;
+		con4.appendElement ( regexp::UnboundedRegExpEmpty < char > { } );
+		con4.appendElement ( b );
+		regexp::UnboundedRegExpAlternation < char > alt4;
+		alt4.appendElement ( con4 );
+		alt4.appendElement ( alt3 );
+
+		regexp::UnboundedRegExpAlternation < char > alt5;
+		alt5.appendElement ( con1 );
+		alt5.appendElement ( alt4 );
+
+		regexp::UnboundedRegExp < char > regexp ( regexp::UnboundedRegExpStructure < char > { alt5 } );
+
+		regexp::UnboundedRegExp < char > res = regexp::simplify::RegExpOptimize::optimize ( regexp );
+
+		regexp::UnboundedRegExpConcatenation < char > con6;
+		con6.appendElement ( a );
+		con6.appendElement ( b );
+		regexp::UnboundedRegExpAlternation < char > alt6;
+		alt6.appendElement ( a );
+		alt6.appendElement ( con6 );
+
+		regexp::UnboundedRegExp < char > regexpRes( regexp::UnboundedRegExpStructure < char > { alt6 } );
+
+		std::cout << regexp << std::endl;
+		std::cout << res << std::endl;
+		std::cout << regexpRes << std::endl;
+
+		CPPUNIT_ASSERT ( regexpRes == res );
+	}
+/*	{
+		std::string input = "a z + a b* b z";
+		regexp::UnboundedRegExp < > regexp( static_cast<const regexp::UnboundedRegExp < > &>( alib::StringDataFactory::fromString<regexp::RegExp>(input).getData() ) );
+
+		regexp::UnboundedRegExp < > res = regexp::simplify::RegExpOptimize::optimize(regexp);
+
+		std::string inputRes = "a b* z";
+		regexp::UnboundedRegExp < > regexpRes( static_cast<const regexp::UnboundedRegExp < > &>( alib::StringDataFactory::fromString<regexp::RegExp>(inputRes).getData() ) );
+
+		std::cout << res << std::endl;
+		std::cout << regexpRes << std::endl;
+
+		CPPUNIT_ASSERT ( regexpRes == res );
+	}*/
+
+}
+
diff --git a/alib2algo/test-src/regexp/simplify/RegExpOptimizeTest.h b/alib2algo/test-src/regexp/simplify/RegExpOptimizeTest.h
index 4e584efdc0d476ec7d54aee3681584e32e275969..64241080e0a40c3099b30fa0bef7c4410814cbba 100644
--- a/alib2algo/test-src/regexp/simplify/RegExpOptimizeTest.h
+++ b/alib2algo/test-src/regexp/simplify/RegExpOptimizeTest.h
@@ -7,6 +7,7 @@ class RegExpOptimizeTest : public CppUnit::TestFixture
 {
   CPPUNIT_TEST_SUITE( RegExpOptimizeTest );
   CPPUNIT_TEST( testOptimize );
+  CPPUNIT_TEST( testOptimizeTemplated );
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -14,6 +15,7 @@ public:
   void tearDown();
 
   void testOptimize();
+  void testOptimizeTemplated();
 };
 
 #endif  // REG_EXP_OPTIMIZE_TEST_H_