- setenv( "RMR_RTG_SVC", "localhost", 1); // test ability to generate default port
- uta_lookup_rtg( &ctx );
- errors += fail_if_nil( ctx.rtg_addr, "rtg lookup did not return a pointer (no port)" );
- errors += fail_not_equal( ctx.rtg_port, 5656, "rtg lookup did not return default port" );
-
- unsetenv( "RMR_RTG_SVC" ); // this should fail as the default name (rtg) will be unknown during testing
- i = uta_lookup_rtg( &ctx );
- errors += fail_if_true( i, "rtg lookup returned that it found something when not expected to" );
-
-
- // ------------ my ip stuff -----------------------------------------------------------------
-
- if_list = mk_ip_list( "1235" );
- errors += fail_if_nil( if_list, "mk_ip_list returned nil pointer" );
-
- i = has_myip( NULL, NULL, ',', 128 ); // should be false if pointers are nil
- errors += fail_if_true( i, "has_myip returned true when given nil buffer" );
-
- i = has_myip( "buffer contents not valid", NULL, ',', 128 ); // should be false if pointers are nil
- errors += fail_if_true( i, "has_myip returned true when given nil list" );
-
- i = has_myip( "buffer contents not valid", NULL, ',', 1 ); // should be false if max < 2
- errors += fail_if_true( i, "has_myip returned true when given small max value" );
-
- i = has_myip( "buffer.contents.not.valid", if_list, ',', 128 ); // should be false as there is nothing valid in the list
- errors += fail_if_true( i, "has_myip returned true when given a buffer with no valid info" );
-
-
- setenv( "RMR_BIND_IF", "192.168.4.30", 1 ); // drive the case where we have a hard set interface; and set known interface in list
- if_list = mk_ip_list( "1235" );
- errors += fail_if_nil( if_list, "mk_ip_list with env set returned nil pointer" );
-
- i = has_myip( "192.168.1.2:1235,192.168.4.30:1235,192.168.2.19:4567", if_list, ',', 128 ); // should find our ip in middle
- errors += fail_if_false( i, "has_myip did not find IP in middle of list" );
-
- i = has_myip( "192.168.4.30:1235,192.168.2.19:4567,192.168.2.19:2222", if_list, ',', 128 ); // should find our ip at head
- errors += fail_if_false( i, "has_myip did not find IP at head of list" );
-
- i = has_myip( "192.168.23.45:4444,192.168.1.2:1235,192.168.4.30:1235", if_list, ',', 128 ); // should find our ip at end
- errors += fail_if_false( i, "has_myip did not find IP at tail of list" );
-
- i = has_myip( "192.168.4.30:1235", if_list, ',', 128 ); // should find our ip when only in list
- errors += fail_if_false( i, "has_myip did not find IP when only one in list" );