X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Frmr_si_api_static_test.c;h=5f0a4f46e63e75949961ae6fa50c20af51aa5a6f;hb=refs%2Fchanges%2F09%2F5909%2F2;hp=5424e986382a129bf530195246cb8251e301066d;hpb=c8e651e15839411c85e105d16fd2ffc14c1cc1dd;p=ric-plt%2Flib%2Frmr.git diff --git a/test/rmr_si_api_static_test.c b/test/rmr_si_api_static_test.c index 5424e98..5f0a4f4 100644 --- a/test/rmr_si_api_static_test.c +++ b/test/rmr_si_api_static_test.c @@ -66,6 +66,30 @@ #include "rmr.h" #include "rmr_agnostic.h" +/* + Driving ep counts is tricky when trying to do it as a part of the rts function, so + we drive that code on it's own. +*/ +static int test_ep_counts() { + int errors = 0; + struct endpoint ep; // need a dummy endpoint + + memset( &ep, 0, sizeof( ep ) ); + + incr_ep_counts( RMR_OK, &ep ); + errors += fail_if_false( ep.scounts[EPSC_GOOD] == 1, "ep inc good counter had bad value" ); + + incr_ep_counts( RMR_ERR_RETRY, &ep ); + errors += fail_if_false( ep.scounts[EPSC_TRANS] == 1, "ep inc trans counter had bad value" ); + + incr_ep_counts( 99, &ep ); // any non-retry/ok value + errors += fail_if_false( ep.scounts[EPSC_FAIL] == 1, "ep inc fail counter had bad value" ); + + incr_ep_counts( RMR_OK, NULL ); // ensure nil pointer doesn't crash us + + return errors; +} + static int rmr_api_test( ) { int errors = 0; void* rmc; // route manager context @@ -283,6 +307,11 @@ static int rmr_api_test( ) { setenv( "RMR_RTG_SVC", "-1", 1 ); // force into static table mode rmr_init( ":6789", 1024, 0 ); // threaded mode with static table + + // ---- some things must be pushed specifically for edge cases and such ------------------------------------ + errors += test_ep_counts(); + init_err( "test error message", rmc, rmc2, ENOMEM ); // drive for coverage + // --------------- phew, done ------------------------------------------------------------------------------ if( ! errors ) {