#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"
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( );
// 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();