X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fmetrics_test.cpp;h=1999dc7c3603ef633c201976f7ecc1b6ef445090;hb=refs%2Fheads%2Fi-release;hp=3b939e3953a3d9059f9c04051e017249b1969a58;hpb=ef3620529c936a8790d6970c57198b4caee09c0d;p=ric-plt%2Fxapp-frame-cpp.git diff --git a/test/metrics_test.cpp b/test/metrics_test.cpp index 3b939e3..1999dc7 100644 --- a/test/metrics_test.cpp +++ b/test/metrics_test.cpp @@ -45,6 +45,7 @@ #include "../src/xapp/xapp.hpp" #include "../src/metrics/metrics.hpp" // overtly pull the code under test to get coverage opts +#include "../src/messaging/messenger.cpp" #include "../src/metrics/metrics.cpp" #include "ut_support.cpp" @@ -54,16 +55,20 @@ int main( int argc, char** argv ) { std::shared_ptr x; std::shared_ptr m; - set_test_name( "jhash_test" ); + set_test_name( "metrics_test" ); x = std::shared_ptr( new Xapp( "4560", true ) ); - if( x == NULL ) { - fprintf( stderr, " unable to allocate xapp object\n" ); + if( fail_if( x == NULL, "could not allocate new xapp" ) ) { announce_results( 1 ); return 1; } m = x->Alloc_metrics( ); + if( fail_if( m == NULL, "could not allocate a metric object" ) ) { + announce_results( errors ); + return errors; + } + m->Push_data( "barney_balance", 216.49 ); m->Push_data( "fred_balance", 760.88 ); m->Send( ); @@ -79,10 +84,20 @@ int main( int argc, char** argv ) { // drive alternate builders m = x->Alloc_metrics( "different-source" ); + if( fail_if( m == NULL, "could not allocate a metric object" ) ) { + announce_results( errors ); + return errors; + } + m->Push_data( "wilma_balance", 1986.0430 ); m->Send(); m = x->Alloc_metrics( "different-app", "different-source" ); + if( fail_if( m == NULL, "could not allocate a metric object" ) ) { + announce_results( errors ); + return errors; + } + m->Push_data( "wilma_balance", 1986.0430 ); m->Push_data( "pebbles_balance", 1982.0614 ); m->Send();