Commit 3a2ca8f 1 parent 5fc0bc5 commit 3a2ca8f Copy full SHA for 3a2ca8f
File tree 3 files changed +25
-12
lines changed
3 files changed +25
-12
lines changed Original file line number Diff line number Diff line change 5
5
#include < stdexcept>
6
6
#include < vector>
7
7
#include < random>
8
+ #include < string>
8
9
9
10
#include < ctc.h>
10
11
12
+ #define CHECK_STATUS (func_call, status ) \
13
+ { \
14
+ bool s = func_call; \
15
+ std::string funcname = #func_call; \
16
+ if (s) { \
17
+ std::cout << " -- TEST " << funcname << " PASS!\n " ; \
18
+ } else { \
19
+ std::cout << " -- TEST " << funcname << " FAILED!\n " ; \
20
+ } \
21
+ status &= s; \
22
+ }
23
+
11
24
inline void throw_on_error (ctcStatus_t status, const char * message) {
12
25
if (status != CTC_STATUS_SUCCESS) {
13
26
throw std::runtime_error (message + (" , stat = " +
Original file line number Diff line number Diff line change @@ -374,16 +374,16 @@ int main(void) {
374
374
std::cout << " Running CPU tests" << std::endl;
375
375
376
376
bool status = true ;
377
- status &= small_test ();
378
- status &= options_test ();
379
- status &= inf_test ();
380
- status &= run_tests ();
377
+ CHECK_STATUS ( small_test (), status );
378
+ CHECK_STATUS ( options_test (), status );
379
+ CHECK_STATUS ( inf_test (), status );
380
+ CHECK_STATUS ( run_tests (), status );
381
381
382
382
if (status) {
383
- std::cout << " Tests pass " << std::endl;
383
+ std::cout << " All tests PASS! " << std::endl;
384
384
return 0 ;
385
385
} else {
386
- std::cout << " Some or all tests fail " << std::endl;
386
+ std::cout << " Some or all tests FAILED! " << std::endl;
387
387
return 1 ;
388
388
}
389
389
}
Original file line number Diff line number Diff line change @@ -678,16 +678,16 @@ int main(void) {
678
678
#endif
679
679
680
680
bool status = true ;
681
- status &= small_test ();
682
- status &= options_test ();
683
- status &= inf_test ();
684
- status &= run_tests ();
681
+ CHECK_STATUS ( small_test (), status );
682
+ CHECK_STATUS ( options_test (), status );
683
+ CHECK_STATUS ( inf_test (), status );
684
+ CHECK_STATUS ( run_tests (), status );
685
685
686
686
if (status) {
687
- std::cout << " Tests pass " << std::endl;
687
+ std::cout << " All tests PASS! " << std::endl;
688
688
return 0 ;
689
689
} else {
690
- std::cout << " Some or all tests fail " << std::endl;
690
+ std::cout << " Some or all tests FAILED! " << std::endl;
691
691
return 1 ;
692
692
}
693
693
}
You can’t perform that action at this time.
0 commit comments