diff --git a/alib2integrationtest/test-src/tests/glushkovRteTest.cpp b/alib2integrationtest/test-src/tests/glushkovRteTest.cpp index e5d9efef9239dc272f4b7f5d7b3ef3d1927c26c5..5b6f83a2a3a5d4e47dd3638a8717dae4e263bee1 100644 --- a/alib2integrationtest/test-src/tests/glushkovRteTest.cpp +++ b/alib2integrationtest/test-src/tests/glushkovRteTest.cpp @@ -32,7 +32,7 @@ TEST_CASE ( "GlushkovRTE", "[integration]" ) { for ( size_t i = 0; i < TESTCASES; i++ ) { ext::vector < std::string > qs = { "execute < " + file + " | rte::convert::ToPostfixPushdownAutomatonGlushkov - | automaton::determinize::Determinize - > $pda", - "execute \"\\\"" + m_Generators.at ( base ) -> generate ( ) + "\\\"\" | string::Parse @string::String ^ - > $string", + "execute \"" + m_Generators.at ( base ) -> generate ( ) + "\" | string::Parse @tree::Tree ^ - | string::StringConcatenate ( PostfixRankedTree ) - <(string::Parse @string::String \"\\\"#$\\\"\") > $string", "quit automaton::run::Accept $pda $string", }; diff --git a/alib2integrationtest/test-src/tests/glushkovRteTestGenerators.hpp b/alib2integrationtest/test-src/tests/glushkovRteTestGenerators.hpp index d2cdab1a4d35e6a5dc1d0cf7c4cd5e63f7addf9c..55a0ae5a806bd8d41c5fe80103b85ba441e705dc 100644 --- a/alib2integrationtest/test-src/tests/glushkovRteTestGenerators.hpp +++ b/alib2integrationtest/test-src/tests/glushkovRteTestGenerators.hpp @@ -11,8 +11,8 @@ class TreeGenerator { public: std::string generate ( ) { m_Str.clear ( ); + m_Str += "RANKED_TREE "; S ( ); - m_Str += "#$"; return m_Str; } @@ -27,16 +27,18 @@ size_t TreeGenerator::MAX_LENGTH = 1000; class TreeGenerator1 : public TreeGenerator { private: void S ( size_t depth = 1 ) { - m_Str += ( depth > MAX_DEPTH || randint ( 0, 1 ) == 0 ) ? "b " : "c "; S2 ( depth + 1 ); + m_Str += ( depth > MAX_DEPTH || randint ( 0, 1 ) == 0 ) ? "b 0 " : "c 0 "; } void S2 ( size_t depth ) { if ( depth > MAX_DEPTH || randint ( 0, 1 ) == 0 ) return; - m_Str += "b a d "; + m_Str += "d 1 "; + m_Str += "a 2 "; S2 ( depth + 1 ); + m_Str += randint ( 0, 1 ) == 0 ? "b 0 " : "c 0 "; } }; @@ -44,7 +46,7 @@ class TreeGenerator1 : public TreeGenerator { class TreeGenerator2 : public TreeGenerator { private: void S ( size_t /* depth = 1 */ ) { - m_Str += "b b a "; + m_Str += "a 2 b 0 b 0 "; } }; @@ -53,13 +55,13 @@ class TreeGenerator3 : public TreeGenerator { private: void S ( size_t depth = 1 ) { if ( depth > MAX_DEPTH || randint ( 0, 1 ) == 0 ) { - m_Str += "b "; + m_Str += "b 0 "; return; } + m_Str += "a 2 "; S ( depth + 1 ); S ( depth + 1 ); - m_Str += "a "; } }; @@ -68,13 +70,13 @@ class TreeGenerator4 : public TreeGenerator { private: void S ( size_t depth = 1 ) { if ( depth > MAX_DEPTH || randint ( 0, 1 ) == 0 ) { - m_Str += "b b a "; + m_Str += "a 2 b 0 b 0 "; return; } + m_Str += "a 2 "; S ( depth + 1 ); S ( depth + 1 ); - m_Str += "a "; } }; @@ -82,7 +84,7 @@ class TreeGenerator4 : public TreeGenerator { class TreeGenerator5 : public TreeGenerator { private: void S ( size_t /* depth = 1 */ ) { - m_Str += "a "; + m_Str += "a 0 "; } }; @@ -90,15 +92,15 @@ class TreeGenerator5 : public TreeGenerator { class TreeGenerator6 : public TreeGenerator { private: void S ( size_t depth = 1 ) { + m_Str += "a 2 "; SL ( depth + 1 ); SR ( depth + 1 ); - m_Str += "a "; } void SL ( size_t depth ) { int r = randint ( 0, 1 ); if ( r == 0 || depth > MAX_DEPTH ) - m_Str += "b "; + m_Str += "b 0 "; else if ( r == 1 ) S ( depth + 1 ); } @@ -106,7 +108,7 @@ class TreeGenerator6 : public TreeGenerator { void SR ( size_t depth ) { int r = randint ( 0, 1 ); if ( r == 0 || depth > MAX_DEPTH ) - m_Str += "c "; + m_Str += "c 0 "; else if ( r == 1 ) S ( depth + 1 ); } @@ -116,15 +118,15 @@ class TreeGenerator6 : public TreeGenerator { class TreeGenerator7 : public TreeGenerator { private: void S ( size_t depth = 1 ) { - m_Str += "c b a "; S2 ( depth + 1 ); + m_Str += "a 2 c 0 b 0 "; } void S2 ( size_t depth ) { if ( depth > MAX_DEPTH || randint ( 0, 2 ) == 0 ) return; - m_Str += "d "; + m_Str += "d 1 "; S2 ( depth + 1 ); } }; @@ -134,13 +136,13 @@ class TreeGenerator8 : public TreeGenerator { private: void S ( size_t depth = 1 ) { if ( depth > MAX_DEPTH || randint ( 0, 1 ) == 0 ) { - m_Str += std::string ( 1, 'b' + randint ( 0, 3 ) ) + ' '; + m_Str += std::string ( 1, 'b' + randint ( 0, 3 ) ) + " 0 "; return; } + m_Str += "a 2 "; S ( depth + 1 ); S ( depth + 1 ); - m_Str += "a "; } }; @@ -149,11 +151,11 @@ class TreeGenerator9 : public TreeGenerator { private: void S ( size_t depth = 1 ) { if ( depth > MAX_DEPTH || randint ( 0, 1 ) == 0 ) { - m_Str += "b "; + m_Str += "b 0 "; } else { + m_Str += "a 2 "; S ( depth + 1 ); S ( depth + 1 ); - m_Str += "a "; } } };