1 #ifndef TESTSUITE_UTILS_H 2 #define TESTSUITE_UTILS_H 3 4 #include <fstream> 5 #include <iostream> 6 7 #define xstrfy( s ) strfy( s ) 8 #define strfy( x ) #x 9 10 #define GET_RESSOURCES_PATH( relpath ) xstrfy( GUM_SRC_PATH ) "/testunits/ressources/" relpath 11 #define XGET_RESSOURCES_PATH( x ) \ 12 xstrfy( GUM_SRC_PATH ) "/testunits/ressources/" xstrfy( x ) 13 14 namespace gum_tests { 15 const std::string waiter[]{"[* ]", "[ * ]", "[ *]", "[ * ]"}; 16 const std::string backst = "\b\b\b\b\b"; 17 begin_test_waiting()18 void begin_test_waiting() { 19 std::cout << waiter[0]; 20 std::flush( std::cout ); 21 } 22 23 void test_waiting( int s = -1 ) { 24 static int ss = 0; 25 26 if ( s == -1 ) s = ss++; 27 std::cout << backst << waiter[s % 4]; 28 std::flush( std::cout ); 29 } 30 end_test_waiting()31 void end_test_waiting() { 32 std::cout << backst; 33 std::flush( std::cout ); 34 } 35 str2file(const std::string & filename,const std::string & message)36 void str2file( const std::string& filename, const std::string& message ) { 37 std::ofstream outFile; 38 outFile.open( filename ); 39 outFile << message << std::endl; 40 outFile.close(); 41 } 42 } 43 #endif // TESTSUITE_UTILS_H 44