MCPcopy Create free account
hub / github.com/boostorg/asio / test

Function test

test/ip/network_v4.cpp:32–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30namespace ip_network_v4_compile {
31
32void test()
33{
34 using namespace boost::asio;
35 namespace ip = boost::asio::ip;
36
37 try
38 {
39 boost::system::error_code ec;
40
41 // network_v4 constructors.
42
43 ip::network_v4 net1(ip::make_address_v4("192.168.1.0"), 32);
44 ip::network_v4 net2(ip::make_address_v4("192.168.1.0"),
45 ip::make_address_v4("255.255.255.0"));
46
47 // network_v4 functions.
48
49 ip::address_v4 addr1 = net1.address();
50 (void)addr1;
51
52 unsigned short prefix_len = net1.prefix_length();
53 (void)prefix_len;
54
55 ip::address_v4 addr2 = net1.netmask();
56 (void)addr2;
57
58 ip::address_v4 addr3 = net1.network();
59 (void)addr3;
60
61 ip::address_v4 addr4 = net1.broadcast();
62 (void)addr4;
63
64 ip::address_v4_range hosts = net1.hosts();
65 (void)hosts;
66
67 ip::network_v4 net3 = net1.canonical();
68 (void)net3;
69
70 bool b1 = net1.is_host();
71 (void)b1;
72
73 bool b2 = net1.is_subnet_of(net2);
74 (void)b2;
75
76 std::string s1 = net1.to_string();
77 (void)s1;
78
79 std::string s2 = net1.to_string(ec);
80 (void)s2;
81
82 // network_v4 comparisons.
83
84 bool b3 = (net1 == net2);
85 (void)b3;
86
87 bool b4 = (net1 != net2);
88 (void)b4;
89

Callers

nothing calls this directly

Calls 15

make_address_v4Function · 0.85
make_network_v4Function · 0.85
stringFunction · 0.85
networkMethod · 0.80
address_v4Class · 0.50
network_v4Class · 0.50
addressMethod · 0.45
prefix_lengthMethod · 0.45
broadcastMethod · 0.45
canonicalMethod · 0.45
is_hostMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected