X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fmetrics_test.cpp;fp=test%2Fmetrics_test.cpp;h=1999dc7c3603ef633c201976f7ecc1b6ef445090;hb=23d0e614733c0305738d8c70d2e4c3e56beb6473;hp=120bbda21f1f192784766da7cfce1bc1b69c5729;hpb=c7e5ea3aedd61576a66497e9aa16ec5421466de2;p=ric-plt%2Fxapp-frame-cpp.git diff --git a/test/metrics_test.cpp b/test/metrics_test.cpp index 120bbda..1999dc7 100644 --- a/test/metrics_test.cpp +++ b/test/metrics_test.cpp @@ -58,13 +58,17 @@ int main( int argc, char** argv ) { 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( ); @@ -80,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();