diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2019-11-04 16:59:05 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2019-11-11 20:14:01 +0100 |
commit | 83d691048b8d181da610ddd45e9a7091310bcd28 (patch) | |
tree | 54385c72b9a54cde460aeae02b5e9596dbeb6c8d /tests | |
parent | 8eae2fcce0620d3a7a66437161050847ac666812 (diff) |
test: add OSMO_SOCKADDR_STR_FMT to sockaddr_str_test.c
This shows the weird format choice for showing IPv6 addresses' port, fixed in
subsequent patch.
Change-Id: I8e5ebfbbc3a2b88aed820e8f845d9f6ededb29de
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sockaddr_str/sockaddr_str_test.c | 2 | ||||
-rw-r--r-- | tests/sockaddr_str/sockaddr_str_test.ok | 22 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/sockaddr_str/sockaddr_str_test.c b/tests/sockaddr_str/sockaddr_str_test.c index 4284387b..bf7d7380 100644 --- a/tests/sockaddr_str/sockaddr_str_test.c +++ b/tests/sockaddr_str/sockaddr_str_test.c @@ -107,6 +107,8 @@ void sockaddr_str_test_conversions() printf("\n\n"); dump_oip(x); + printf(" OSMO_SOCKADDR_STR_FMT: '" OSMO_SOCKADDR_STR_FMT "'\n", + OSMO_SOCKADDR_STR_FMT_ARGS(x)); printf(" osmo_sockaddr_str_is_set() = %s\n", osmo_sockaddr_str_is_set(x) ? "true" : "false"); printf(" osmo_sockaddr_str_is_nonzero() = %s\n", osmo_sockaddr_str_is_nonzero(x) ? "true" : "false"); diff --git a/tests/sockaddr_str/sockaddr_str_test.ok b/tests/sockaddr_str/sockaddr_str_test.ok index 781e9d10..5ebf7be6 100644 --- a/tests/sockaddr_str/sockaddr_str_test.ok +++ b/tests/sockaddr_str/sockaddr_str_test.ok @@ -1,6 +1,7 @@ { .af = AF_INET, .ip = "1.2.3.4", .port = 5 } + OSMO_SOCKADDR_STR_FMT: '1.2.3.4:5' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = true osmo_sockaddr_str_to_in_addr() rc == 0 in_addr=01020304 @@ -19,6 +20,7 @@ { .af = AF_INET, .ip = "0.0.0.0", .port = 0 } + OSMO_SOCKADDR_STR_FMT: '0.0.0.0:0' osmo_sockaddr_str_is_set() = false osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc == 0 in_addr=00000000 @@ -37,6 +39,7 @@ { .af = AF_INET, .ip = "255.255.255.255", .port = 65535 } + OSMO_SOCKADDR_STR_FMT: '255.255.255.255:65535' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = true osmo_sockaddr_str_to_in_addr() rc == 0 in_addr=ffffffff @@ -55,6 +58,7 @@ { .af = AF_INET, .ip = "0.0.0.256", .port = 1 } + OSMO_SOCKADDR_STR_FMT: '0.0.0.256:1' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -68,6 +72,7 @@ { .af = AF_INET, .ip = "not an ip address", .port = 1 } + OSMO_SOCKADDR_STR_FMT: 'not an ip address:1' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -81,6 +86,7 @@ { .af = AF_INET6, .ip = "1:2:3::4", .port = 5 } + OSMO_SOCKADDR_STR_FMT: '1:2:3::4:5' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = true osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -97,6 +103,7 @@ { .af = AF_INET6, .ip = "::", .port = 0 } + OSMO_SOCKADDR_STR_FMT: ':::0' osmo_sockaddr_str_is_set() = false osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -113,6 +120,7 @@ { .af = AF_INET6, .ip = "::1", .port = 0 } + OSMO_SOCKADDR_STR_FMT: '::1:0' osmo_sockaddr_str_is_set() = false osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -129,6 +137,7 @@ { .af = AF_INET6, .ip = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", .port = 65535 } + OSMO_SOCKADDR_STR_FMT: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:65535' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = true osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -145,6 +154,7 @@ { .af = AF_INET6, .ip = "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", .port = 65535 } + OSMO_SOCKADDR_STR_FMT: 'FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:65535' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = true osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -164,6 +174,7 @@ { .af = AF_INET6, .ip = "::fffff", .port = 1 } + OSMO_SOCKADDR_STR_FMT: '::fffff:1' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -177,6 +188,7 @@ { .af = AF_INET6, .ip = "not an ip address", .port = 1 } + OSMO_SOCKADDR_STR_FMT: 'not an ip address:1' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -190,6 +202,7 @@ { .af = AF_INET6, .ip = "1.2.3.4", .port = 5 } + OSMO_SOCKADDR_STR_FMT: '1.2.3.4:5' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -204,6 +217,7 @@ { .af = AF_INET, .ip = "1:2:3::4", .port = 5 } + OSMO_SOCKADDR_STR_FMT: '1:2:3::4:5' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -218,6 +232,7 @@ { .af = AF_UNSPEC, .ip = "1.2.3.4", .port = 5 } + OSMO_SOCKADDR_STR_FMT: '1.2.3.4:5' osmo_sockaddr_str_is_set() = false osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -232,6 +247,7 @@ { .af = AF_INET, .ip = "", .port = 5 } + OSMO_SOCKADDR_STR_FMT: ':5' osmo_sockaddr_str_is_set() = false osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -245,6 +261,7 @@ { .af = AF_INET6, .ip = "", .port = 5 } + OSMO_SOCKADDR_STR_FMT: ':5' osmo_sockaddr_str_is_set() = false osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -258,6 +275,7 @@ { .af = AF_INET, .ip = "1.2.3.4", .port = 0 } + OSMO_SOCKADDR_STR_FMT: '1.2.3.4:0' osmo_sockaddr_str_is_set() = false osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc == 0 in_addr=01020304 @@ -276,6 +294,7 @@ { .af = AF_INET, .ip = "1.2.3:4:5", .port = 0 } + OSMO_SOCKADDR_STR_FMT: '1.2.3:4:5:0' osmo_sockaddr_str_is_set() = false osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -290,6 +309,7 @@ { .af = AF_INET6, .ip = "::1:10.9.8.7", .port = 1 } + OSMO_SOCKADDR_STR_FMT: '::1:10.9.8.7:1' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = true osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 @@ -309,6 +329,7 @@ { .af = AF_INET, .ip = "0.0.0.0", .port = 5 } + OSMO_SOCKADDR_STR_FMT: '0.0.0.0:5' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc == 0 in_addr=00000000 @@ -327,6 +348,7 @@ { .af = AF_INET6, .ip = "::", .port = 5 } + OSMO_SOCKADDR_STR_FMT: ':::5' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 |