diff --git a/alib2integrationtest/test-src/tests/glushkovRteTest.cpp b/alib2integrationtest/test-src/tests/glushkovRteTest.cpp index 82ab6c5baf4adce11305207d3652bc3901fd87d3..991260a53a7c077368912c6a1a7b1a21f147453d 100644 --- a/alib2integrationtest/test-src/tests/glushkovRteTest.cpp +++ b/alib2integrationtest/test-src/tests/glushkovRteTest.cpp @@ -11,6 +11,7 @@ static size_t TESTCASES = 50; std::map < std::string, std::shared_ptr < TreeGenerator > > m_Generators = { + { "rte0.xml", std::make_shared < TreeGenerator0 > ( ) }, { "rte1.xml", std::make_shared < TreeGenerator1 > ( ) }, { "rte2.xml", std::make_shared < TreeGenerator2 > ( ) }, { "rte3.xml", std::make_shared < TreeGenerator3 > ( ) }, @@ -23,12 +24,13 @@ std::map < std::string, std::shared_ptr < TreeGenerator > > m_Generators = { }; TEST_CASE ( "GlushkovRTE", "[integration]" ) { - for ( const std::string & file : TestFiles::Get ( "/rte/rte[0-9]+.xml$" ) ) { - char * p_filepath = strdup ( file.c_str ( ) ); - std::string base = basename ( p_filepath ); // be careful, there are posix and gnu versions - free ( p_filepath ); - SECTION ( "To PDA" ) { + SECTION ( "To PDA" ) { + for ( const std::string & file : TestFiles::Get ( "/rte/rte[0-9]+.xml$" ) ) { + char * p_filepath = strdup ( file.c_str ( ) ); + std::string base = basename ( p_filepath ); // be careful, there are posix and gnu versions + free ( p_filepath ); + try { for ( size_t i = 0; i < TESTCASES; i++ ) { ext::vector < std::string > qs = { @@ -44,8 +46,14 @@ TEST_CASE ( "GlushkovRTE", "[integration]" ) { FAIL ( "No generator assigned for file " << file ); } } + } + + SECTION ( "To FTA" ) { + for ( const std::string & file : TestFiles::Get ( "/rte/rte[0-9]+.xml$" ) ) { + char * p_filepath = strdup ( file.c_str ( ) ); + std::string base = basename ( p_filepath ); // be careful, there are posix and gnu versions + free ( p_filepath ); - SECTION ( "To FTA" ) { try { for ( size_t i = 0; i < TESTCASES; i++ ) { ext::vector < std::string > qs = { diff --git a/alib2integrationtest/test-src/tests/glushkovRteTestGenerators.hpp b/alib2integrationtest/test-src/tests/glushkovRteTestGenerators.hpp index c5e8fb9cf71ec513768012b363a3c97af63b2e18..3c89442911d22d1a1e4b622f711348a2d43214b8 100644 --- a/alib2integrationtest/test-src/tests/glushkovRteTestGenerators.hpp +++ b/alib2integrationtest/test-src/tests/glushkovRteTestGenerators.hpp @@ -162,3 +162,50 @@ class TreeGenerator9 : public TreeGenerator { } } }; + +/** Generator for rte0.xml */ +class TreeGenerator0 : public TreeGenerator { + private: + void S ( size_t depth = 1 ) { + a1 ( depth ); + } + + void a1 ( size_t depth ) { + if ( depth > MAX_DEPTH || randint ( 0, 1 ) == 0 ) { + m_Str += "d 0 "; + } else { + m_Str += "a 1 "; + if ( randint ( 0, 1 ) == 0 ) { + b1 ( depth + 1 ); + } else { + c1 ( depth + 1 ); + } + } + } + + void b1 ( size_t depth ) { + if ( depth > MAX_DEPTH || randint ( 0, 1 ) == 0 ) { + m_Str += "d 0 "; + } else { + m_Str += "b 1 "; + if ( randint ( 0, 1 ) == 0 ) { + b1 ( depth + 1 ); + } else { + a1 ( depth + 1 ); + } + } + } + + void c1 ( size_t depth ) { + if ( depth > MAX_DEPTH || randint ( 0, 1 ) == 0 ) { + m_Str += "d 0 "; + } else { + m_Str += "c 1 "; + if ( randint ( 0, 1 ) == 0 ) { + c1 ( depth + 1 ); + } else { + a1 ( depth + 1 ); + } + } + } +};