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