doc(code): Indent fixes and whitespace cleanup
[ric-plt/lib/rmr.git] / test / tools_test.c
index 786d2e6..eac19a6 100644 (file)
@@ -1,14 +1,14 @@
 // : vi ts=4 sw=4 noet :
 /*
 ==================================================================================
 // : vi ts=4 sw=4 noet :
 /*
 ==================================================================================
-        Copyright (c) 2019 Nokia 
-        Copyright (c) 2018-2019 AT&T Intellectual Property.
+           Copyright (c) 2019 Nokia
+           Copyright (c) 2018-2019 AT&T Intellectual Property.
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
 
-       http://www.apache.org/licenses/LICENSE-2.0
+          http://www.apache.org/licenses/LICENSE-2.0
 
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
 
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
 #include <pthread.h>
 #include <ctype.h>
 
 #include <pthread.h>
 #include <ctype.h>
 
-/*
-#include <nanomsg/nn.h>
-#include <nanomsg/tcp.h>
-#include <nanomsg/pair.h>
-#include <nanomsg/pipeline.h>
-#include <nanomsg/pubsub.h>
-*/
-
 #include "../src/common/include/rmr.h"
 #include "../src/common/include/rmr_agnostic.h"
 #include "test_support.c"              // our private library of test tools
 #include "../src/common/include/rmr.h"
 #include "../src/common/include/rmr_agnostic.h"
 #include "test_support.c"              // our private library of test tools
@@ -63,10 +55,10 @@ struct uta_ctx {
        route_table_t* new_rtable;      // route table under construction
        if_addrs_t*     ip_list;                // list manager of the IP addresses that are on our known interfaces
        void*   mring;                          // ring where msgs are queued while waiting for a call response msg
        route_table_t* new_rtable;      // route table under construction
        if_addrs_t*     ip_list;                // list manager of the IP addresses that are on our known interfaces
        void*   mring;                          // ring where msgs are queued while waiting for a call response msg
-       
+
        char*   rtg_addr;                       // addr/port of the route table generation publisher
        int             rtg_port;                       // the port that the rtg listens on
        char*   rtg_addr;                       // addr/port of the route table generation publisher
        int             rtg_port;                       // the port that the rtg listens on
-       
+
        wh_mgt_t*       wormholes;              // management of user opened wormholes
        //epoll_stuff_t*        eps;            // epoll information needed for the rcv with timeout call
 
        wh_mgt_t*       wormholes;              // management of user opened wormholes
        //epoll_stuff_t*        eps;            // epoll information needed for the rcv with timeout call
 
@@ -88,7 +80,7 @@ int main( ) {
        uta_ctx_t ctx;                          // context for uta_lookup test
        void*   if_list;
 
        uta_ctx_t ctx;                          // context for uta_lookup test
        void*   if_list;
 
-       
+
        // ------------------ tokenise tests -----------------------------------------------------------
        dbuf = strdup( buf );
        i = uta_tokenise( dbuf, tokens, 127, ',' );
        // ------------------ tokenise tests -----------------------------------------------------------
        dbuf = strdup( buf );
        i = uta_tokenise( dbuf, tokens, 127, ',' );
@@ -114,7 +106,7 @@ int main( ) {
 
        j = uta_has_str( buf, "Mrs. Slate", ',', 27 );
        errors += fail_if_true( j >= 0, "has string not found Mrs. Slate" );
 
        j = uta_has_str( buf, "Mrs. Slate", ',', 27 );
        errors += fail_if_true( j >= 0, "has string not found Mrs. Slate" );
-       
+
        // ------------ host name 2 ip tests ---------------------------------------------------------
        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" );
        // ------------ host name 2 ip tests ---------------------------------------------------------
        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" );
@@ -129,7 +121,7 @@ int main( ) {
        // ------------ rtg lookup test -------------------------------------------------------------
        ctx.rtg_port = 0;
        ctx.rtg_addr = NULL;
        // ------------ rtg lookup test -------------------------------------------------------------
        ctx.rtg_port = 0;
        ctx.rtg_addr = NULL;
-       
+
        i = uta_lookup_rtg( NULL );                                             // ensure it handles a nil context
        errors += fail_if_true( i, "rtg lookup returned that it found something when not expected to (nil context)" );
 
        i = uta_lookup_rtg( NULL );                                             // ensure it handles a nil context
        errors += fail_if_true( i, "rtg lookup returned that it found something when not expected to (nil context)" );
 
@@ -148,18 +140,6 @@ int main( ) {
        i = uta_lookup_rtg( &ctx );
        errors += fail_if_true( i, "rtg lookup returned that it found something when not expected to" );
 
        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 -----------------------------------------------------------------