--- sa_test.c 2001/10/10 15:50:31 1.9
+++ sa_test.c 2001/10/31 19:28:49 1.10
@@ -38,7 +38,7 @@
#include "ts.h"
#include "sa.h"
-TST_FUNC(test_saa_impexp)
+TS_TEST(test_saa_impexp)
{
sa_addr_t *saa;
sa_rc_t rv;
@@ -62,30 +62,30 @@
{ "unix:", SA_ERR_ARG, NULL }
};
- tst_check(TST, "sa_addr_create");
+ ts_test_check(TS_CTX, "sa_addr_create");
if ((rv = sa_addr_create(&saa)) != SA_OK)
- tst_fail(TST, "sa_addr_create -> %d[%s] (expected %d[%s])",
+ ts_test_fail(TS_CTX, "sa_addr_create -> %d[%s] (expected %d[%s])",
rv, sa_error(rv), SA_OK, sa_error(SA_OK));
for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) {
- tst_check(TST, "sa_addr_u2a(\"%s\")", table[i].in);
+ ts_test_check(TS_CTX, "sa_addr_u2a(\"%s\")", table[i].in);
if ((rv = sa_addr_u2a(saa, table[i].in)) != table[i].rv)
- tst_fail(TST, "sa_addr_a2u -> %d[%s] (expected %d[%s])",
+ ts_test_fail(TS_CTX, "sa_addr_a2u -> %d[%s] (expected %d[%s])",
rv, sa_error(rv), table[i].rv, sa_error(table[i].rv));
- tst_check(TST, "sa_addr_a2u");
+ ts_test_check(TS_CTX, "sa_addr_a2u");
if ((rv = sa_addr_a2u(saa, &cp)) != SA_OK)
- tst_fail(TST, "sa_addr_u2a -> %d[%s] (expected %d[%s])",
+ 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)
- tst_fail(TST, "sa_addr_a2u -> \"%s\" (expected \"%s\")", cp, table[i].out);
+ ts_test_fail(TS_CTX, "sa_addr_a2u -> \"%s\" (expected \"%s\")", cp, table[i].out);
}
- tst_check(tst, "sa_addr_destroy");
+ ts_test_check(TS_CTX, "sa_addr_destroy");
if ((rv = sa_addr_destroy(saa)) != SA_OK)
- tst_fail(TST, "sa_addr_destroy -> %d[%s] (expected %d[%s])",
+ ts_test_fail(TS_CTX, "sa_addr_destroy -> %d[%s] (expected %d[%s])",
rv, sa_error(rv), SA_OK, sa_error(SA_OK));
}
-TST_FUNC(test_saa_match)
+TS_TEST(test_saa_match)
{
sa_addr_t *saa1;
sa_addr_t *saa2;
@@ -120,10 +120,10 @@
continue;
if ((rv = sa_addr_u2a(saa2, table[i].acl)) != SA_OK)
continue;
- tst_check(TST, "sa_addr_match(\"%s\", \"%s\", %d)",
+ ts_test_check(TS_CTX, "sa_addr_match(\"%s\", \"%s\", %d)",
table[i].in, table[i].acl, table[i].prefixlen);
if ((rv = sa_addr_match(saa1, saa2, table[i].prefixlen)) != table[i].rv)
- tst_fail(TST, "sa_addr_match -> %d[%s] (expected %d[%s])",
+ ts_test_fail(TS_CTX, "sa_addr_match -> %d[%s] (expected %d[%s])",
rv, sa_error(rv), table[i].rv, sa_error(table[i].rv));
}
sa_addr_destroy(saa1);
@@ -132,14 +132,14 @@
int main(int argc, char *argv[])
{
- ts_t *ts;
+ ts_suite_t *ts;
int n;
- ts = ts_new("OSSP SA (Socket Abstraction Library)");
- ts_test(ts, test_saa_impexp, "socket address abstraction (import/export)");
- ts_test(ts, test_saa_match, "socket address abstraction (matching)");
- n = ts_run(ts);
- ts_free(ts);
+ ts = ts_suite_new("OSSP SA (Socket Abstraction Library)");
+ ts_suite_test(ts, test_saa_impexp, "socket address abstraction (import/export)");
+ ts_suite_test(ts, test_saa_match, "socket address abstraction (matching)");
+ n = ts_suite_run(ts);
+ ts_suite_free(ts);
return n;
}
|