diff --git a/test/unit/addrfilt.c b/test/unit/addrfilt.c index fec45e3..3a21671 100644 --- a/test/unit/addrfilt.c +++ b/test/unit/addrfilt.c @@ -36,10 +36,10 @@ test_unit(void) for (j = 0; j < 1000; j++) { if (j % 2) { maxsub = 32; - get_random_address(&ip, IPADDR_INET4, -1); + TST_GetRandomAddress(&ip, IPADDR_INET4, -1); } else { maxsub = 128; - get_random_address(&ip, IPADDR_INET6, -1); + TST_GetRandomAddress(&ip, IPADDR_INET6, -1); } DEBUG_LOG(0, "address %s", UTI_IPToString(&ip)); @@ -51,16 +51,16 @@ test_unit(void) TEST_CHECK(ADF_IsAllowed(table, &ip)); if (sub < maxsub) { - swap_address_bit(&ip, sub); + TST_SwapAddressBit(&ip, sub); TEST_CHECK(ADF_IsAllowed(table, &ip)); } if (sub > 0) { - swap_address_bit(&ip, sub - 1); + TST_SwapAddressBit(&ip, sub - 1); TEST_CHECK(!ADF_IsAllowed(table, &ip)); if (sub % 4 != 1) { ADF_Deny(table, &ip, sub - 1); - swap_address_bit(&ip, sub - 1); + TST_SwapAddressBit(&ip, sub - 1); TEST_CHECK(!ADF_IsAllowed(table, &ip)); } } diff --git a/test/unit/clientlog.c b/test/unit/clientlog.c index 2dda992..85e7f19 100644 --- a/test/unit/clientlog.c +++ b/test/unit/clientlog.c @@ -48,7 +48,7 @@ test_unit(void) tv.tv_usec = 0; for (j = 0; j < 1000; j++) { - get_random_address(&ip, IPADDR_UNSPEC, i % 8 ? -1 : i / 8 % 9); + TST_GetRandomAddress(&ip, IPADDR_UNSPEC, i % 8 ? -1 : i / 8 % 9); DEBUG_LOG(0, "address %s", UTI_IPToString(&ip)); if (random() % 2) { diff --git a/test/unit/ntp_sources.c b/test/unit/ntp_sources.c index c16d5ae..40df9d3 100644 --- a/test/unit/ntp_sources.c +++ b/test/unit/ntp_sources.c @@ -51,7 +51,7 @@ test_unit(void) for (j = 0; j < sizeof (addrs) / sizeof (addrs[0]); j++) { do { - get_random_address(&addrs[j].ip_addr, IPADDR_UNSPEC, -1); + TST_GetRandomAddress(&addrs[j].ip_addr, IPADDR_UNSPEC, -1); } while (UTI_IPToHash(&addrs[j].ip_addr) % (1U << i) != hash % (1U << i)); addrs[j].port = random() % 1024; diff --git a/test/unit/test.c b/test/unit/test.c index 1a7bc4a..3a11033 100644 --- a/test/unit/test.c +++ b/test/unit/test.c @@ -25,7 +25,7 @@ #include "test.h" void -test_fail(int line) +TST_Fail(int line) { printf("FAIL (on line %d)\n", line); exit(1); @@ -69,7 +69,7 @@ main(int argc, char **argv) } void -get_random_address(IPAddr *ip, int family, int bits) +TST_GetRandomAddress(IPAddr *ip, int family, int bits) { if (family != IPADDR_INET4 && family != IPADDR_INET6) family = random() % 2 ? IPADDR_INET4 : IPADDR_INET6; @@ -104,7 +104,7 @@ get_random_address(IPAddr *ip, int family, int bits) } void -swap_address_bit(IPAddr *ip, unsigned int b) +TST_SwapAddressBit(IPAddr *ip, unsigned int b) { if (ip->family == IPADDR_INET4) { assert(b < 32); diff --git a/test/unit/test.h b/test/unit/test.h index d1e83cb..e736e27 100644 --- a/test/unit/test.h +++ b/test/unit/test.h @@ -28,14 +28,14 @@ extern void test_unit(void); #define TEST_CHECK(expr) \ do { \ if (!(expr)) { \ - test_fail(__LINE__); \ + TST_Fail(__LINE__); \ exit(1); \ } \ } while (0) -extern void test_fail(int line); +extern void TST_Fail(int line); -extern void get_random_address(IPAddr *ip, int family, int bits); -extern void swap_address_bit(IPAddr *ip, unsigned int b); +extern void TST_GetRandomAddress(IPAddr *ip, int family, int bits); +extern void TST_SwapAddressBit(IPAddr *ip, unsigned int b); #endif