| 65 | /* AUTOGENERATED MOCKS END */ |
| 66 | |
| 67 | int main(int argc, char *argv[]) |
| 68 | { |
| 69 | struct wireaddr_internal addr, *expect = tal(NULL, struct wireaddr_internal); |
| 70 | |
| 71 | common_setup(argv[0]); |
| 72 | /* Simple IPv4 address. */ |
| 73 | assert(parse_wireaddr_internal(tmpctx, "127.0.0.1", DEFAULT_PORT, false, &addr) == NULL); |
| 74 | expect->itype = ADDR_INTERNAL_WIREADDR; |
| 75 | expect->u.wireaddr.is_websocket = false; |
| 76 | assert(parse_wireaddr(tmpctx, "127.0.0.1:9735", 0, NULL, &expect->u.wireaddr.wireaddr) == NULL); |
| 77 | assert(wireaddr_internal_eq(&addr, expect)); |
| 78 | |
| 79 | /* IPv4 address with port. */ |
| 80 | assert(parse_wireaddr_internal(tmpctx, "127.0.0.1:1", DEFAULT_PORT, false, &addr) == NULL); |
| 81 | expect->itype = ADDR_INTERNAL_WIREADDR; |
| 82 | expect->u.wireaddr.is_websocket = false; |
| 83 | assert(parse_wireaddr(tmpctx, "127.0.0.1:1", 0, NULL, &expect->u.wireaddr.wireaddr) == NULL); |
| 84 | assert(wireaddr_internal_eq(&addr, expect)); |
| 85 | |
| 86 | /* Simple IPv6 address. */ |
| 87 | assert(parse_wireaddr_internal(tmpctx, "::1", DEFAULT_PORT, false, &addr) == NULL); |
| 88 | expect->itype = ADDR_INTERNAL_WIREADDR; |
| 89 | expect->u.wireaddr.is_websocket = false; |
| 90 | assert(parse_wireaddr(tmpctx, "::1", DEFAULT_PORT, NULL, &expect->u.wireaddr.wireaddr) == NULL); |
| 91 | assert(wireaddr_internal_eq(&addr, expect)); |
| 92 | |
| 93 | /* IPv6 address with port. */ |
| 94 | assert(parse_wireaddr_internal(tmpctx, "[::1]:1", DEFAULT_PORT, false, &addr) == NULL); |
| 95 | expect->itype = ADDR_INTERNAL_WIREADDR; |
| 96 | expect->u.wireaddr.is_websocket = false; |
| 97 | assert(parse_wireaddr(tmpctx, "::1", 1, NULL, &expect->u.wireaddr.wireaddr) == NULL); |
| 98 | assert(wireaddr_internal_eq(&addr, expect)); |
| 99 | |
| 100 | /* autotor address */ |
| 101 | assert(parse_wireaddr_internal(tmpctx, "autotor:127.0.0.1", DEFAULT_PORT, false, &addr) == NULL); |
| 102 | expect->itype = ADDR_INTERNAL_AUTOTOR; |
| 103 | expect->u.torservice.port = DEFAULT_PORT; |
| 104 | assert(parse_wireaddr(tmpctx, "127.0.0.1", 9051, NULL, &expect->u.torservice.address) == NULL); |
| 105 | assert(wireaddr_internal_eq(&addr, expect)); |
| 106 | |
| 107 | /* autotor address with port */ |
| 108 | assert(parse_wireaddr_internal(tmpctx, "autotor:127.0.0.1:9055", DEFAULT_PORT, false, &addr) == NULL); |
| 109 | expect->itype = ADDR_INTERNAL_AUTOTOR; |
| 110 | expect->u.torservice.port = DEFAULT_PORT; |
| 111 | assert(parse_wireaddr(tmpctx, "127.0.0.1", 9055, NULL, &expect->u.torservice.address) == NULL); |
| 112 | assert(wireaddr_internal_eq(&addr, expect)); |
| 113 | |
| 114 | /* autotor address with torport */ |
| 115 | assert(parse_wireaddr_internal(tmpctx, "autotor:127.0.0.1/torport=9055", DEFAULT_PORT, false, &addr) == NULL); |
| 116 | expect->itype = ADDR_INTERNAL_AUTOTOR; |
| 117 | expect->u.torservice.port = 9055; |
| 118 | assert(parse_wireaddr(tmpctx, "127.0.0.1", 9051, NULL, &expect->u.torservice.address) == NULL); |
| 119 | assert(wireaddr_internal_eq(&addr, expect)); |
| 120 | |
| 121 | /* autotor address with port and torport */ |
| 122 | assert(parse_wireaddr_internal(tmpctx, "autotor:127.0.0.1:9055/torport=10055", DEFAULT_PORT, false, &addr) == NULL); |
| 123 | expect->itype = ADDR_INTERNAL_AUTOTOR; |
| 124 | expect->u.torservice.port = 10055; |
nothing calls this directly
no test coverage detected