|
|
|
@ -17,14 +17,30 @@ int main() {
|
|
|
|
|
assert(addr->matches.max == 15); |
|
|
|
|
assert(addr->matches.used == 0); |
|
|
|
|
|
|
|
|
|
assert(0); /* TODO: add more ips to list & test this cases */ |
|
|
|
|
|
|
|
|
|
assert((list = f2b_addrlist_append(list, addr)) != NULL); |
|
|
|
|
assert(f2b_addrlist_lookup(list, "127.0.0.1") != NULL); |
|
|
|
|
assert(list == addr); |
|
|
|
|
|
|
|
|
|
assert((list = f2b_addrlist_remove(list, "127.4.4.4")) != NULL); |
|
|
|
|
assert((list = f2b_addrlist_remove(list, "127.0.0.1")) == NULL); |
|
|
|
|
assert(list == NULL); |
|
|
|
|
|
|
|
|
|
assert((addr = f2b_ipaddr_create("127.0.0.1", 15)) != NULL); |
|
|
|
|
assert((list = f2b_addrlist_append(list, addr)) != NULL); |
|
|
|
|
assert((addr = f2b_ipaddr_create("127.0.0.2", 15)) != NULL); |
|
|
|
|
assert((list = f2b_addrlist_append(list, addr)) != NULL); |
|
|
|
|
assert((addr = f2b_ipaddr_create("127.0.0.3", 15)) != NULL); |
|
|
|
|
assert((list = f2b_addrlist_append(list, addr)) != NULL); |
|
|
|
|
assert((addr = f2b_ipaddr_create("127.0.0.4", 15)) != NULL); |
|
|
|
|
assert((list = f2b_addrlist_append(list, addr)) != NULL); |
|
|
|
|
assert((addr = f2b_ipaddr_create("127.0.0.5", 15)) != NULL); |
|
|
|
|
assert((list = f2b_addrlist_append(list, addr)) != NULL); |
|
|
|
|
|
|
|
|
|
assert((list = f2b_addrlist_remove(list, "127.0.0.2")) != NULL); |
|
|
|
|
assert((list = f2b_addrlist_remove(list, "127.0.0.4")) != NULL); |
|
|
|
|
assert((list = f2b_addrlist_remove(list, "127.0.0.3")) != NULL); |
|
|
|
|
assert((list = f2b_addrlist_remove(list, "127.0.0.5")) != NULL); |
|
|
|
|
assert((list = f2b_addrlist_remove(list, "127.0.0.1")) == NULL); |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|