| 17 | /* AUTOGENERATED MOCKS END */ |
| 18 | |
| 19 | int main(int argc, char *argv[]) |
| 20 | { |
| 21 | struct wireaddr wa; |
| 22 | const char *err; |
| 23 | |
| 24 | common_setup(argv[0]); |
| 25 | |
| 26 | // start with IPv4 |
| 27 | err = parse_wireaddr(tmpctx, "0.0.0.0", DEFAULT_PORT, NULL, &wa); |
| 28 | assert(!err); |
| 29 | assert(!IsValid(&wa)); |
| 30 | assert(IsIPv4(&wa)); |
| 31 | assert(!IsIPv6(&wa)); |
| 32 | err = parse_wireaddr(tmpctx, "255.255.255.255", DEFAULT_PORT, NULL, &wa); |
| 33 | assert(!err); |
| 34 | assert(!IsValid(&wa)); |
| 35 | assert(IsIPv4(&wa)); |
| 36 | assert(!IsIPv6(&wa)); |
| 37 | |
| 38 | err = parse_wireaddr(tmpctx, "127.0.0.1", DEFAULT_PORT, NULL, &wa); |
| 39 | assert(!err); |
| 40 | assert(IsValid(&wa)); |
| 41 | assert(IsIPv4(&wa)); |
| 42 | assert(!IsIPv6(&wa)); |
| 43 | assert(IsLocal(&wa)); |
| 44 | assert(address_routable(&wa, true)); |
| 45 | assert(!address_routable(&wa, false)); |
| 46 | |
| 47 | err = parse_wireaddr(tmpctx, "0.1.2.3", DEFAULT_PORT, NULL, &wa); |
| 48 | assert(!err); |
| 49 | assert(IsValid(&wa)); |
| 50 | assert(IsIPv4(&wa)); |
| 51 | assert(!IsIPv6(&wa)); |
| 52 | assert(IsLocal(&wa)); |
| 53 | assert(address_routable(&wa, true)); |
| 54 | assert(!address_routable(&wa, false)); |
| 55 | |
| 56 | err = parse_wireaddr(tmpctx, "10.0.21.42", DEFAULT_PORT, NULL, &wa); |
| 57 | assert(!err); |
| 58 | assert(IsValid(&wa)); |
| 59 | assert(IsIPv4(&wa)); |
| 60 | assert(!IsIPv6(&wa)); |
| 61 | assert(!IsLocal(&wa)); |
| 62 | assert(IsRFC1918(&wa)); |
| 63 | assert(!address_routable(&wa, true)); |
| 64 | assert(!address_routable(&wa, false)); |
| 65 | |
| 66 | err = parse_wireaddr(tmpctx, "192.168.123.4", DEFAULT_PORT, NULL, &wa); |
| 67 | assert(!err); |
| 68 | assert(IsValid(&wa)); |
| 69 | assert(IsIPv4(&wa)); |
| 70 | assert(!IsIPv6(&wa)); |
| 71 | assert(!IsLocal(&wa)); |
| 72 | assert(IsRFC1918(&wa)); |
| 73 | assert(!address_routable(&wa, true)); |
| 74 | assert(!address_routable(&wa, false)); |
| 75 | |
| 76 | err = parse_wireaddr(tmpctx, "1.2.3.4", DEFAULT_PORT, NULL, &wa); |
nothing calls this directly
no test coverage detected