Replace custom isc_boolean_t with C standard bool type
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <atf-c.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/netaddr.h>
|
||||
@@ -41,20 +42,20 @@ ATF_TC_BODY(sockaddr_hash, tc) {
|
||||
|
||||
UNUSED(tc);
|
||||
|
||||
result = isc_test_begin(NULL, ISC_TRUE, 0);
|
||||
result = isc_test_begin(NULL, true, 0);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
in.s_addr = inet_addr("127.0.0.1");
|
||||
isc_sockaddr_fromin(&addr, &in, 1);
|
||||
h1 = isc_sockaddr_hash(&addr, ISC_TRUE);
|
||||
h2 = isc_sockaddr_hash(&addr, ISC_FALSE);
|
||||
h1 = isc_sockaddr_hash(&addr, true);
|
||||
h2 = isc_sockaddr_hash(&addr, false);
|
||||
ATF_CHECK(h1 != h2);
|
||||
|
||||
ret = inet_pton(AF_INET6, "::ffff:127.0.0.1", &in6);
|
||||
ATF_CHECK(ret == 1);
|
||||
isc_sockaddr_fromin6(&addr, &in6, 1);
|
||||
h3 = isc_sockaddr_hash(&addr, ISC_TRUE);
|
||||
h4 = isc_sockaddr_hash(&addr, ISC_FALSE);
|
||||
h3 = isc_sockaddr_hash(&addr, true);
|
||||
h4 = isc_sockaddr_hash(&addr, false);
|
||||
ATF_CHECK(h1 == h3);
|
||||
ATF_CHECK(h2 == h4);
|
||||
|
||||
@@ -69,36 +70,36 @@ ATF_TC_BODY(sockaddr_isnetzero, tc) {
|
||||
isc_sockaddr_t addr;
|
||||
struct in_addr in;
|
||||
struct in6_addr in6;
|
||||
isc_boolean_t r;
|
||||
bool r;
|
||||
int ret;
|
||||
size_t i;
|
||||
struct {
|
||||
const char *string;
|
||||
isc_boolean_t expect;
|
||||
bool expect;
|
||||
} data4[] = {
|
||||
{ "0.0.0.0", ISC_TRUE },
|
||||
{ "0.0.0.1", ISC_TRUE },
|
||||
{ "0.0.1.0", ISC_TRUE },
|
||||
{ "0.1.0.0", ISC_TRUE },
|
||||
{ "1.0.0.0", ISC_FALSE },
|
||||
{ "0.0.0.127", ISC_TRUE },
|
||||
{ "0.0.0.255", ISC_TRUE },
|
||||
{ "127.0.0.1", ISC_FALSE },
|
||||
{ "255.255.255.255", ISC_FALSE },
|
||||
{ "0.0.0.0", true },
|
||||
{ "0.0.0.1", true },
|
||||
{ "0.0.1.0", true },
|
||||
{ "0.1.0.0", true },
|
||||
{ "1.0.0.0", false },
|
||||
{ "0.0.0.127", true },
|
||||
{ "0.0.0.255", true },
|
||||
{ "127.0.0.1", false },
|
||||
{ "255.255.255.255", false },
|
||||
};
|
||||
/*
|
||||
* Mapped addresses are currently not netzero.
|
||||
*/
|
||||
struct {
|
||||
const char *string;
|
||||
isc_boolean_t expect;
|
||||
bool expect;
|
||||
} data6[] = {
|
||||
{ "::ffff:0.0.0.0", ISC_FALSE },
|
||||
{ "::ffff:0.0.0.1", ISC_FALSE },
|
||||
{ "::ffff:0.0.0.127", ISC_FALSE },
|
||||
{ "::ffff:0.0.0.255", ISC_FALSE },
|
||||
{ "::ffff:127.0.0.1", ISC_FALSE },
|
||||
{ "::ffff:255.255.255.255", ISC_FALSE },
|
||||
{ "::ffff:0.0.0.0", false },
|
||||
{ "::ffff:0.0.0.1", false },
|
||||
{ "::ffff:0.0.0.127", false },
|
||||
{ "::ffff:0.0.0.255", false },
|
||||
{ "::ffff:127.0.0.1", false },
|
||||
{ "::ffff:255.255.255.255", false },
|
||||
};
|
||||
|
||||
UNUSED(tc);
|
||||
@@ -122,8 +123,8 @@ ATF_TC_BODY(sockaddr_isnetzero, tc) {
|
||||
ATF_TC(sockaddr_eqaddrprefix);
|
||||
ATF_TC_HEAD(sockaddr_eqaddrprefix, tc) {
|
||||
atf_tc_set_md_var(tc, "descr",
|
||||
"isc_sockaddr_eqaddrprefix() returns ISC_TRUE when "
|
||||
"prefixes of a and b are equal, and ISC_FALSE when "
|
||||
"isc_sockaddr_eqaddrprefix() returns true when "
|
||||
"prefixes of a and b are equal, and false when "
|
||||
"they are not equal");
|
||||
}
|
||||
ATF_TC_BODY(sockaddr_eqaddrprefix, tc) {
|
||||
|
||||
Reference in New Issue
Block a user