Changeset 113 for trunk/IPs/systemC/processor/Morpheo/Common/include/Test.h
- Timestamp:
- Apr 14, 2009, 8:39:12 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Common/include/Test.h
r88 r113 16 16 #include "Common/include/ErrorMorpheo.h" 17 17 #include "Common/include/ToString.h" 18 18 #include "Common/include/Systemc.h" 19 19 namespace morpheo { 20 20 … … 26 26 inline void test_ko_error (void) 27 27 { 28 std::string msg = "Test ko : error in test \""+morpheo::toString(num_test)+"\"";28 std::string msg = morpheo::toString(_("Test ko : error in test \"%d\""),num_test); 29 29 throw (morpheo::ErrorMorpheo (msg)); 30 30 } … … 33 33 inline void test_ko (char * file, uint32_t line, T exp1, T exp2) 34 34 { 35 fflush (stdout); 36 fflush (stderr); 37 38 std::cerr << "[" << num_test << "] : " << STR_KO 39 << "\tline " << line << std::endl 40 << " * Localisation" << std::endl 41 << " - File : " << file << std::endl 42 << " - Line : " << line << std::endl 43 << " * Expression is different" << std::endl 44 << " - exp1 : "+morpheo::toString(exp1) << std::endl 45 << " - exp2 : "+morpheo::toString(exp2) << std::endl; 35 msgError(_("[%d] : %s\n"),num_test,STR_KO); 36 msgError(_(" * Localisation\n")); 37 msgError(_(" - File : %s\n"),file); 38 msgError(_(" - Line : %d\n"),line); 39 msgError(_(" * Expression is different\n")); 40 msgError(_(" - exp1 : %s\n"),morpheo::toString(exp1).c_str()); 41 msgError(_(" - exp2 : %s\n"),morpheo::toString(exp2).c_str()); 46 42 47 43 test_ko_error (); … … 50 46 inline void test_ko (char * file, uint32_t line) 51 47 { 52 fflush (stdout); 53 fflush (stderr); 54 55 std::cerr << "[" << num_test << "] : " << STR_KO 56 << "\tline " << line << std::endl 57 << " * Localisation" << std::endl 58 << " - File : " << file << std::endl 59 << " - Line : " << line << std::endl; 48 msgError(_("[%d] : %s\n"),num_test,STR_KO); 49 msgError(_(" * Localisation\n")); 50 msgError(_(" - File : %s\n"),file); 51 msgError(_(" - Line : %d\n"),line); 60 52 61 53 test_ko_error (); … … 64 56 inline void test_ok () 65 57 { 66 fflush (stdout); 67 fflush (stderr); 68 69 msg (_("[%d] : %s\n"), num_test,STR_OK); 58 msgInformation (_("[%d] : %s\n"), num_test,STR_OK); 70 59 71 60 num_test ++; … … 74 63 inline void test_ok (char * file, uint32_t line) 75 64 { 76 fflush (stdout); 77 fflush (stderr); 78 79 msg (_("[%d] : %s\n"), num_test,STR_OK); 80 msg (_("\tline %d\n"), line); 65 msgInformation (_("[%d] : %s (line %d)\n"), num_test,STR_OK,line); 66 msgInformation (_(" - Line : %d\n"), line); 81 67 82 68 num_test ++; … … 86 72 inline void test_ok (char * file, uint32_t line, T exp) 87 73 { 88 fflush (stdout); 89 fflush (stderr); 90 91 msg (_("[%d] : %s\n"), num_test, STR_OK); 92 msg (_("\tline %d\n"), line); 93 msg (_("\tvalue %s\n"), (morpheo::toString(exp)).c_str()); 74 msgInformation (_("[%d] : %s\n"), num_test, STR_OK); 75 msgInformation (_(" - Line : %d\n"), line); 76 msgInformation (_(" - Value : %s\n"), (morpheo::toString(exp)).c_str()); 94 77 95 78 num_test ++; … … 112 95 #define LABEL(str...) \ 113 96 { \ 114 msg (_("{%d} "),static_cast<uint32_t>(sc_simulation_time())); \ 115 msg (str); \ 116 msg (_("\n")); \ 117 fflush (stdout); \ 97 msgInformation (_("{%.0f} "),simulation_cycle()); \ 98 msg (str); \ 99 msg (_("\n")); \ 118 100 } while(0) 119 101 … … 122 104 #endif 123 105 124 #define SC_ START(cycle_offset) \106 #define SC_CYCLE(cycle_offset) \ 125 107 do \ 126 108 { \ 127 /*cout << "SC_ START(begin)" << endl;*/ \109 /*cout << "SC_CYCLE (begin)" << endl;*/ \ 128 110 \ 129 uint32_t cycle_current = static_cast<uint32_t>(sc_simulation_time());\111 double cycle_current = simulation_cycle(); \ 130 112 if (cycle_offset != 0) \ 131 113 { \ 132 cout << "##########[ cycle "<< cycle_current+cycle_offset << " ] (" << __LINE__ << ")" << endl; \114 msgInformation(_("##########[ cycle %.0f ] (%d)\n"),cycle_current+cycle_offset,__LINE__); \ 133 115 } \ 134 116 \ … … 138 120 } \ 139 121 \ 140 s c_start(cycle_offset);\122 simulation_run(cycle_offset); \ 141 123 \ 142 /*cout << "SC_ START(end )" << endl;*/ \124 /*cout << "SC_CYCLE (end )" << endl;*/ \ 143 125 } while(0) 144 126 145 127 // old support 128 #ifndef MTI_SYSTEMC 129 # define SC_START(x) SC_CYCLE(x) 130 #endif 146 131 147 132 };
Note: See TracChangeset
for help on using the changeset viewer.