CI: Update RTD configuration file
[ric-plt/xapp-frame-cpp.git] / test / metrics_test.cpp
index 3b939e3..1999dc7 100644 (file)
@@ -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<Xapp> x;
        std::shared_ptr<xapp::Metrics> m;
 
-       set_test_name( "jhash_test" );
+       set_test_name( "metrics_test" );
 
        x = std::shared_ptr<Xapp>( new Xapp( "4560", true ) );
-       if( x == NULL ) {
-               fprintf( stderr, "<FAIL> 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();