Add first set of SI95 unit tests and health check
[ric-plt/lib/rmr.git] / test / tools_static_test.c
index 9e156ec..0269522 100644 (file)
@@ -107,12 +107,15 @@ static int tools_test( ) {
        hname = uta_h2ip( "192.168.1.2" );
        errors += fail_not_equal( strcmp( hname, "192.168.1.2" ), 0, "h2ip did not return IP address when given address" );
        errors += fail_if_nil( hname, "h2ip did not return a pointer" );
+       free( hname );
 
        hname = uta_h2ip( "yahoo.com" );
        errors += fail_if_nil( hname, "h2ip did not return a pointer" );
+       free( hname );
 
        hname = uta_h2ip( "yahoo.com:1234" );                                                   // should ignore the port
        errors += fail_if_nil( hname, "h2ip did not return a pointer" );
+       free( hname );
 
        // ------------ rtg lookup test -------------------------------------------------------------
        ctx.rtg_port = 0;
@@ -136,20 +139,7 @@ static int tools_test( ) {
        i = uta_lookup_rtg( &ctx );
        errors += fail_if_true( i, "rtg lookup returned that it found something when not expected to" );
 
-/*
-//==== moved out of generic tools ==========
-       // -------------- test link2 stuff ----------------------------------------------------------
-       i = uta_link2( "bad" );                                 // should fail
-       errors += fail_if_true( i >= 0, "uta_link2 didn't fail when given bad address" );
-
-       i = uta_link2( "nohost:-1234" );
-       errors += fail_if_true( i >= 0, "uta_link2 did not failed when given a bad (negative) port " );
-
-       i = uta_link2( "nohost:1234" );                                 // nn should go off and set things up, but it will never successd, but uta_ call should
-       errors += fail_if_true( i < 0, "uta_link2 failed when not expected to" );
-*/
-
-       // ------------ my ip stuff -----------------------------------------------------------------
+       // ------------ my_ip stuff -----------------------------------------------------------------
 
        if_list = mk_ip_list( "1235" );
        errors += fail_if_nil( if_list, "mk_ip_list returned nil pointer" );
@@ -188,6 +178,7 @@ static int tools_test( ) {
 
        ip = get_default_ip( if_list );
        if( ip ) {
+               free( ip );
        } else {
                errors += fail_if_nil( ip, "get_defaul_ip returned nil pointer when valid pointer expected" );
        }
@@ -203,6 +194,8 @@ static int tools_test( ) {
                } else {
                        errors += fail_if_nil( if_list, "mk_ip_list with a specific interface name returned a nil list" );
                }
+
+               free( ip );
        }
 
 // -------------------------------------------------------------------------------------------------