ignore "Anonymous query through public resolver" errors
[ghsmtp.git] / IP6-test.cpp
blobcefa7ab9287a8697b995388ce778f456c8dbb866
1 #include "IP6.hpp"
3 #include "Domain.hpp"
5 #include <glog/logging.h>
7 int main(int argc, char const* argv[])
9 using IP6::as_address;
10 using IP6::is_address;
11 using IP6::is_address_literal;
12 using IP6::is_private;
13 using IP6::to_address_literal;
15 CHECK(is_address("::1"));
16 CHECK(is_address_literal("[IPv6:::1]"));
18 CHECK(is_address("::ffff:0.0.0.0"));
19 CHECK(is_address("::ffff:255.255.255.255"));
21 CHECK(is_address("::ffff:0:0.0.0.0"));
22 CHECK(is_address("::ffff:0:255.255.255.255"));
24 CHECK(is_address("fd12:3456:789a:1::1"));
26 auto const addr{"2001:0db8:85a3:0000:0000:8a2e:0370:7334"};
27 auto const addr_lit{"[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:7334]"};
29 CHECK(is_address(addr));
30 CHECK(is_address_literal(addr_lit));
32 CHECK(!is_private(addr));
33 CHECK(is_private("fd12:3456:789a:1::1"));
35 CHECK_EQ(to_address_literal(addr), addr_lit);
36 CHECK_EQ(as_address(addr_lit), addr);