OSSP CVS Repository

ossp - Difference in ossp-pkg/sa/sa_test.c versions 1.24 and 1.25
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/sa/sa_test.c 1.24 -> 1.25

--- sa_test.c    2003/01/31 18:34:06     1.24
+++ sa_test.c    2003/02/07 20:47:51     1.25
@@ -56,18 +56,19 @@
         char *in;
         sa_rc_t rv;
         char *out;
+        char *out_alt;
     } table[] = {
         /* positive tests */
-        { "inet://0.0.0.0:0", SA_OK, "inet://0.0.0.0:0" },
-        { "inet://127.0.0.1:514", SA_OK, "inet://127.0.0.1:514" },
-        { "inet://localhost:syslog#udp", SA_OK, "inet://127.0.0.1:514" },
-        { "inet://localhost:smtp", SA_OK, "inet://127.0.0.1:25" },
-        { "unix:/tmp/socket", SA_OK, "unix:/tmp/socket" },
+        { "inet://0.0.0.0:0", SA_OK, "inet://0.0.0.0:0", NULL },
+        { "inet://127.0.0.1:514", SA_OK, "inet://127.0.0.1:514", NULL },
+        { "inet://localhost:syslog#udp", SA_OK, "inet://127.0.0.1:514", "inet://[::1]:514" },
+        { "inet://localhost:smtp", SA_OK, "inet://127.0.0.1:25", "inet://[::1]:25" },
+        { "unix:/tmp/socket", SA_OK, "unix:/tmp/socket", NULL },
         /* negative tests */
-        { "inet:", SA_ERR_ARG, NULL },
-        { "inet://1.2.3.4.5:0", SA_ERR_ARG, NULL },
-        { "inet://just-hostname", SA_ERR_ARG, NULL },
-        { "unix:", SA_ERR_ARG, NULL }
+        { "inet:", SA_ERR_ARG, NULL, NULL },
+        { "inet://1.2.3.4.5:0", SA_ERR_ARG, NULL, NULL },
+        { "inet://just-hostname", SA_ERR_ARG, NULL, NULL },
+        { "unix:", SA_ERR_ARG, NULL, NULL }
     };
 
     ts_test_check(TS_CTX, "sa_addr_create");
@@ -83,10 +84,18 @@
         if ((rv = sa_addr_a2u(saa, &cp)) != SA_OK)
             ts_test_fail(TS_CTX, "sa_addr_u2a -> %d[%s] (expected %d[%s])",
                          rv, sa_error(rv), SA_OK, sa_error(SA_OK));
-        if (table[i].rv == SA_OK)
-            if (strcmp(cp, table[i].out) != 0)
-                ts_test_fail(TS_CTX, "sa_addr_a2u -> \"%s\" (expected \"%s\")",
-                             cp, table[i].out);
+        if (table[i].rv == SA_OK) {
+            if (table[i].out_alt != NULL) {
+                if (strcmp(cp, table[i].out) != 0 && strcmp(cp, table[i].out_alt) != 0)
+                    ts_test_fail(TS_CTX, "sa_addr_a2u -> \"%s\" (expected \"%s\" or \"%s\")",
+                                 cp, table[i].out, table[i].out_alt);
+            }
+            else {
+                if (strcmp(cp, table[i].out) != 0)
+                    ts_test_fail(TS_CTX, "sa_addr_a2u -> \"%s\" (expected \"%s\")",
+                                 cp, table[i].out);
+            }
+        }
     }
     ts_test_check(TS_CTX, "sa_addr_destroy");
     if ((rv = sa_addr_destroy(saa)) != SA_OK)

CVSTrac 2.0.1