X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Funit_test.cpp;h=3e3c5bc10bfdc0cd48a4ec312447e8fdd1fe7912;hb=ef3620529c936a8790d6970c57198b4caee09c0d;hp=56f40b8bc837a9e8b687320075b087215d91f630;hpb=6ef23e1d7f7f47ccab5be6ff1b68e5cfdda80ad2;p=ric-plt%2Fxapp-frame-cpp.git diff --git a/test/unit_test.cpp b/test/unit_test.cpp index 56f40b8..3e3c5bc 100644 --- a/test/unit_test.cpp +++ b/test/unit_test.cpp @@ -40,6 +40,7 @@ #include "../src/messaging/messenger.hpp" #include "../src/messaging/msg_component.hpp" #include "../src/alarm/alarm.hpp" +#include "../src/metrics/metrics.hpp" #include "../src/xapp/xapp.hpp" #include "../src/messaging/callback.cpp" @@ -107,6 +108,19 @@ void killer( std::shared_ptr x ) { x->Halt(); } +/* + Drive the constructors so that we actually see the coverage + in the .gc* files. The metrics tests will actually verify that + the various underlying functions work. +*/ +static int metrics( std::shared_ptr x ) { + std::shared_ptr m; + + m = x->Alloc_metrics( ); // basic construction + m = x->Alloc_metrics( "different-source" ); // drive alternate builders + m = x->Alloc_metrics( "different-app", "different-source" ); +} + int main( int argc, char** argv ) { std::thread* tinfo; // we'll start a thread that will shut things down after a few seconds std::unique_ptr msg; @@ -321,12 +335,6 @@ int main( int argc, char** argv ) { a = x->Alloc_alarm( 13, "meid-abc" ); errors += fail_if( a == NULL, "unable to allcoate an alarm with meid and problem id" ); - - //#####: 210:xapp::Alarm::Alarm( const Alarm& soi ) { - //#####: 227:Alarm& xapp::Alarm::operator=( const Alarm& soi ) { - //#####: 249:xapp::Alarm::Alarm( Alarm&& soi ) { - //#####: 269:Alarm& xapp::Alarm::operator=( Alarm&& soi ) { - a->Set_meid( "changed_meid" ); for( i = 0; i < 6; i++ ) { a->Set_severity( i ); // drive all switch possibilities @@ -357,6 +365,12 @@ int main( int argc, char** argv ) { b = std::move( c ); // move = operator xapp::Alarm d = std::move( b ); // move constructor + + // ------ minimal metrics to prove coverage ------------------------------------------------------------ + metrics( x ); + + // ------------------------------------------------------------------------------------------------------ + announce_results( errors ); return errors > 0; }