]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Loosen GetAddrInfo Unit-Tests.
authoramosjeffries <>
Fri, 15 Feb 2008 17:46:39 +0000 (17:46 +0000)
committeramosjeffries <>
Fri, 15 Feb 2008 17:46:39 +0000 (17:46 +0000)
Squid does not need certain OS defaults, which are known to vary.

lib/tests/testIPAddress.cc

index 77098118ceb0e2fe234f80ca5e48f4a041da7d72..144a989448a6ff9779c86e284173919e98c34b8e 100644 (file)
@@ -582,19 +582,21 @@ testIPAddress::testAddrInfo()
     /* display a byte-by-byte hex comparison of the addr cores */
     unsigned int *p;
     p = (unsigned int*)expect;
-    printf("\nADDRINFO: %x %x %x %x %x %x ",
+    printf("\nSYS-ADDRINFO: %x %x %x %x %x %x ",
                  p[0],p[1],p[2],p[3],p[4],p[5] );
 
     p = (unsigned int*)ipval;
-    printf("\nADDRINFO: %x %x %x %x %x %x ",
+    printf("\nSQD-ADDRINFO: %x %x %x %x %x %x ",
                  p[0],p[1],p[2],p[3],p[4],p[5] );
     printf("\n");
 
     // check the addrinfo object core. (BUT not the two ptrs at the tail)
-    CPPUNIT_ASSERT( memcmp( expect, ipval, sizeof(struct addrinfo)-(sizeof(void*)*3) ) == 0 );
+    // details
+    CPPUNIT_ASSERT_EQUAL( expect->ai_flags, ipval->ai_flags );
+    CPPUNIT_ASSERT_EQUAL( expect->ai_family, ipval->ai_family );
     // check the sockaddr it points to.
     CPPUNIT_ASSERT_EQUAL( expect->ai_addrlen, ipval->ai_addrlen );
-    CPPUNIT_ASSERT( memcmp( expect, ipval, expect->ai_addrlen ) == 0 );
+    CPPUNIT_ASSERT( memcmp( expect->ai_addr, ipval->ai_addr, expect->ai_addrlen ) == 0 );
 
     xfreeaddrinfo(expect);
 }