Skip to content
Snippets Groups Projects
Commit d431b71f authored by Jan Trávníček's avatar Jan Trávníček
Browse files

fix glushkov rte tests

parent 69f05a8b
No related branches found
No related tags found
No related merge requests found
Pipeline #31865 canceled
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
static size_t TESTCASES = 50; static size_t TESTCASES = 50;
   
std::map < std::string, std::shared_ptr < TreeGenerator > > m_Generators = { std::map < std::string, std::shared_ptr < TreeGenerator > > m_Generators = {
{ "rte0.xml", std::make_shared < TreeGenerator0 > ( ) },
{ "rte1.xml", std::make_shared < TreeGenerator1 > ( ) }, { "rte1.xml", std::make_shared < TreeGenerator1 > ( ) },
{ "rte2.xml", std::make_shared < TreeGenerator2 > ( ) }, { "rte2.xml", std::make_shared < TreeGenerator2 > ( ) },
{ "rte3.xml", std::make_shared < TreeGenerator3 > ( ) }, { "rte3.xml", std::make_shared < TreeGenerator3 > ( ) },
...@@ -23,12 +24,13 @@ std::map < std::string, std::shared_ptr < TreeGenerator > > m_Generators = { ...@@ -23,12 +24,13 @@ std::map < std::string, std::shared_ptr < TreeGenerator > > m_Generators = {
}; };
   
TEST_CASE ( "GlushkovRTE", "[integration]" ) { 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 { try {
for ( size_t i = 0; i < TESTCASES; i++ ) { for ( size_t i = 0; i < TESTCASES; i++ ) {
ext::vector < std::string > qs = { ext::vector < std::string > qs = {
...@@ -44,8 +46,14 @@ TEST_CASE ( "GlushkovRTE", "[integration]" ) { ...@@ -44,8 +46,14 @@ TEST_CASE ( "GlushkovRTE", "[integration]" ) {
FAIL ( "No generator assigned for file " << file ); 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 { try {
for ( size_t i = 0; i < TESTCASES; i++ ) { for ( size_t i = 0; i < TESTCASES; i++ ) {
ext::vector < std::string > qs = { ext::vector < std::string > qs = {
......
...@@ -162,3 +162,50 @@ class TreeGenerator9 : public TreeGenerator { ...@@ -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 );
}
}
}
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment