X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fut_support.cpp;h=27fceb55f56e28a2c74d055a7c0a9f8d300cda0a;hb=refs%2Fchanges%2F01%2F9501%2F2;hp=8e6be90e6c3e8ec462e33769fc780e973f551881;hpb=97204c8a0eb213af5f4c656cd30f1ecf82c8a520;p=ric-plt%2Fxapp-frame-cpp.git diff --git a/test/ut_support.cpp b/test/ut_support.cpp index 8e6be90..27fceb5 100644 --- a/test/ut_support.cpp +++ b/test/ut_support.cpp @@ -28,6 +28,9 @@ #include static std::string test_name = "unknown"; +static int ut_tests_driven = 0; + +// ------------------------------------------------------------------------------- /* Set the name of the current tester @@ -40,6 +43,8 @@ extern void set_test_name( std::string name ) { Returns 1 if the condition is true (not zero) */ extern int fail_if( int cond, std::string reason ) { + ut_tests_driven++; + if( cond ) { fprintf( stderr, " %s: %s\n", test_name.c_str(), reason.c_str() ); return 1; @@ -52,6 +57,8 @@ extern int fail_if( int cond, std::string reason ) { Returns 1 if the condition is false. */ extern int fail_if_false( int cond, std::string reason ) { + ut_tests_driven++; + if( !cond ) { fprintf( stderr, " %s: %s\n", test_name.c_str(), reason.c_str() ); return 1; @@ -61,6 +68,9 @@ extern int fail_if_false( int cond, std::string reason ) { } extern void announce_results( int errors ) { + fprintf( stderr, " %s %d tests drivn, %d passed, %d failed\n", + test_name.c_str(), ut_tests_driven, ut_tests_driven - errors, errors ); + if( errors > 0 ) { fprintf( stderr, " %s: failed with %d errors\n", test_name.c_str(), errors ); } else {