1 //
2 // icmp.cpp
3 // ~~~~~~~~
4 //
5 // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 // Disable autolinking for unit tests.
12 #if !defined(BOOST_ALL_NO_LIB)
13 #define BOOST_ALL_NO_LIB 1
14 #endif // !defined(BOOST_ALL_NO_LIB)
15 
16 // Test that header file is self-contained.
17 #include "asio/ip/icmp.hpp"
18 
19 #include <cstring>
20 #include "asio/io_context.hpp"
21 #include "asio/placeholders.hpp"
22 #include "../unit_test.hpp"
23 #include "../archetypes/async_result.hpp"
24 #include "../archetypes/gettable_socket_option.hpp"
25 #include "../archetypes/io_control_command.hpp"
26 #include "../archetypes/settable_socket_option.hpp"
27 
28 //------------------------------------------------------------------------------
29 
30 // ip_icmp_socket_compile test
31 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 // The following test checks that all public member functions on the class
33 // ip::icmp::socket compile and link correctly. Runtime failures are ignored.
34 
35 namespace ip_icmp_socket_compile {
36 
37 struct connect_handler
38 {
connect_handlerip_icmp_socket_compile::connect_handler39   connect_handler() {}
operator ()ip_icmp_socket_compile::connect_handler40   void operator()(const asio::error_code&) {}
41 #if defined(ASIO_HAS_MOVE)
connect_handlerip_icmp_socket_compile::connect_handler42   connect_handler(connect_handler&&) {}
43 private:
44   connect_handler(const connect_handler&);
45 #endif // defined(ASIO_HAS_MOVE)
46 };
47 
48 struct send_handler
49 {
send_handlerip_icmp_socket_compile::send_handler50   send_handler() {}
operator ()ip_icmp_socket_compile::send_handler51   void operator()(const asio::error_code&, std::size_t) {}
52 #if defined(ASIO_HAS_MOVE)
send_handlerip_icmp_socket_compile::send_handler53   send_handler(send_handler&&) {}
54 private:
55   send_handler(const send_handler&);
56 #endif // defined(ASIO_HAS_MOVE)
57 };
58 
59 struct receive_handler
60 {
receive_handlerip_icmp_socket_compile::receive_handler61   receive_handler() {}
operator ()ip_icmp_socket_compile::receive_handler62   void operator()(const asio::error_code&, std::size_t) {}
63 #if defined(ASIO_HAS_MOVE)
receive_handlerip_icmp_socket_compile::receive_handler64   receive_handler(receive_handler&&) {}
65 private:
66   receive_handler(const receive_handler&);
67 #endif // defined(ASIO_HAS_MOVE)
68 };
69 
test()70 void test()
71 {
72   using namespace asio;
73   namespace ip = asio::ip;
74 
75   try
76   {
77     io_context ioc;
78     const io_context::executor_type ioc_ex = ioc.get_executor();
79     char mutable_char_buffer[128] = "";
80     const char const_char_buffer[128] = "";
81     socket_base::message_flags in_flags = 0;
82     archetypes::settable_socket_option<void> settable_socket_option1;
83     archetypes::settable_socket_option<int> settable_socket_option2;
84     archetypes::settable_socket_option<double> settable_socket_option3;
85     archetypes::gettable_socket_option<void> gettable_socket_option1;
86     archetypes::gettable_socket_option<int> gettable_socket_option2;
87     archetypes::gettable_socket_option<double> gettable_socket_option3;
88     archetypes::io_control_command io_control_command;
89     archetypes::lazy_handler lazy;
90     asio::error_code ec;
91 
92     // basic_datagram_socket constructors.
93 
94     ip::icmp::socket socket1(ioc);
95     ip::icmp::socket socket2(ioc, ip::icmp::v4());
96     ip::icmp::socket socket3(ioc, ip::icmp::v6());
97     ip::icmp::socket socket4(ioc, ip::icmp::endpoint(ip::icmp::v4(), 0));
98     ip::icmp::socket socket5(ioc, ip::icmp::endpoint(ip::icmp::v6(), 0));
99 #if !defined(ASIO_WINDOWS_RUNTIME)
100     ip::icmp::socket::native_handle_type native_socket1
101       = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
102     ip::icmp::socket socket6(ioc, ip::icmp::v4(), native_socket1);
103 #endif // !defined(ASIO_WINDOWS_RUNTIME)
104 
105     ip::icmp::socket socket7(ioc_ex);
106     ip::icmp::socket socket8(ioc_ex, ip::icmp::v4());
107     ip::icmp::socket socket9(ioc_ex, ip::icmp::v6());
108     ip::icmp::socket socket10(ioc_ex, ip::icmp::endpoint(ip::icmp::v4(), 0));
109     ip::icmp::socket socket11(ioc_ex, ip::icmp::endpoint(ip::icmp::v6(), 0));
110 #if !defined(ASIO_WINDOWS_RUNTIME)
111     ip::icmp::socket::native_handle_type native_socket2
112       = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
113     ip::icmp::socket socket12(ioc_ex, ip::icmp::v4(), native_socket2);
114 #endif // !defined(ASIO_WINDOWS_RUNTIME)
115 
116 #if defined(ASIO_HAS_MOVE)
117     ip::icmp::socket socket13(std::move(socket6));
118 #endif // defined(ASIO_HAS_MOVE)
119 
120     // basic_datagram_socket operators.
121 
122 #if defined(ASIO_HAS_MOVE)
123     socket1 = ip::icmp::socket(ioc);
124     socket1 = std::move(socket2);
125 #endif // defined(ASIO_HAS_MOVE)
126 
127     // basic_io_object functions.
128 
129     ip::icmp::socket::executor_type ex = socket1.get_executor();
130     (void)ex;
131 
132     // basic_socket functions.
133 
134     ip::icmp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
135     (void)lowest_layer;
136 
137     const ip::icmp::socket& socket14 = socket1;
138     const ip::icmp::socket::lowest_layer_type& lowest_layer2
139       = socket14.lowest_layer();
140     (void)lowest_layer2;
141 
142     socket1.open(ip::icmp::v4());
143     socket1.open(ip::icmp::v6());
144     socket1.open(ip::icmp::v4(), ec);
145     socket1.open(ip::icmp::v6(), ec);
146 
147 #if !defined(ASIO_WINDOWS_RUNTIME)
148     ip::icmp::socket::native_handle_type native_socket3
149       = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
150     socket1.assign(ip::icmp::v4(), native_socket3);
151     ip::icmp::socket::native_handle_type native_socket4
152       = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
153     socket1.assign(ip::icmp::v4(), native_socket4, ec);
154 #endif // !defined(ASIO_WINDOWS_RUNTIME)
155 
156     bool is_open = socket1.is_open();
157     (void)is_open;
158 
159     socket1.close();
160     socket1.close(ec);
161 
162     socket1.release();
163     socket1.release(ec);
164 
165     ip::icmp::socket::native_handle_type native_socket5
166       = socket1.native_handle();
167     (void)native_socket5;
168 
169     socket1.cancel();
170     socket1.cancel(ec);
171 
172     bool at_mark1 = socket1.at_mark();
173     (void)at_mark1;
174     bool at_mark2 = socket1.at_mark(ec);
175     (void)at_mark2;
176 
177     std::size_t available1 = socket1.available();
178     (void)available1;
179     std::size_t available2 = socket1.available(ec);
180     (void)available2;
181 
182     socket1.bind(ip::icmp::endpoint(ip::icmp::v4(), 0));
183     socket1.bind(ip::icmp::endpoint(ip::icmp::v6(), 0));
184     socket1.bind(ip::icmp::endpoint(ip::icmp::v4(), 0), ec);
185     socket1.bind(ip::icmp::endpoint(ip::icmp::v6(), 0), ec);
186 
187     socket1.connect(ip::icmp::endpoint(ip::icmp::v4(), 0));
188     socket1.connect(ip::icmp::endpoint(ip::icmp::v6(), 0));
189     socket1.connect(ip::icmp::endpoint(ip::icmp::v4(), 0), ec);
190     socket1.connect(ip::icmp::endpoint(ip::icmp::v6(), 0), ec);
191 
192     socket1.async_connect(ip::icmp::endpoint(ip::icmp::v4(), 0),
193         connect_handler());
194     socket1.async_connect(ip::icmp::endpoint(ip::icmp::v6(), 0),
195         connect_handler());
196     int i1 = socket1.async_connect(ip::icmp::endpoint(ip::icmp::v4(), 0), lazy);
197     (void)i1;
198     int i2 = socket1.async_connect(ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
199     (void)i2;
200 
201     socket1.set_option(settable_socket_option1);
202     socket1.set_option(settable_socket_option1, ec);
203     socket1.set_option(settable_socket_option2);
204     socket1.set_option(settable_socket_option2, ec);
205     socket1.set_option(settable_socket_option3);
206     socket1.set_option(settable_socket_option3, ec);
207 
208     socket1.get_option(gettable_socket_option1);
209     socket1.get_option(gettable_socket_option1, ec);
210     socket1.get_option(gettable_socket_option2);
211     socket1.get_option(gettable_socket_option2, ec);
212     socket1.get_option(gettable_socket_option3);
213     socket1.get_option(gettable_socket_option3, ec);
214 
215     socket1.io_control(io_control_command);
216     socket1.io_control(io_control_command, ec);
217 
218     bool non_blocking1 = socket1.non_blocking();
219     (void)non_blocking1;
220     socket1.non_blocking(true);
221     socket1.non_blocking(false, ec);
222 
223     bool non_blocking2 = socket1.native_non_blocking();
224     (void)non_blocking2;
225     socket1.native_non_blocking(true);
226     socket1.native_non_blocking(false, ec);
227 
228     ip::icmp::endpoint endpoint1 = socket1.local_endpoint();
229     (void)endpoint1;
230     ip::icmp::endpoint endpoint2 = socket1.local_endpoint(ec);
231     (void)endpoint2;
232 
233     ip::icmp::endpoint endpoint3 = socket1.remote_endpoint();
234     (void)endpoint3;
235     ip::icmp::endpoint endpoint4 = socket1.remote_endpoint(ec);
236     (void)endpoint4;
237 
238     socket1.shutdown(socket_base::shutdown_both);
239     socket1.shutdown(socket_base::shutdown_both, ec);
240 
241     // basic_datagram_socket functions.
242 
243     socket1.send(buffer(mutable_char_buffer));
244     socket1.send(buffer(const_char_buffer));
245     socket1.send(null_buffers());
246     socket1.send(buffer(mutable_char_buffer), in_flags);
247     socket1.send(buffer(const_char_buffer), in_flags);
248     socket1.send(null_buffers(), in_flags);
249     socket1.send(buffer(mutable_char_buffer), in_flags, ec);
250     socket1.send(buffer(const_char_buffer), in_flags, ec);
251     socket1.send(null_buffers(), in_flags, ec);
252 
253     socket1.async_send(buffer(mutable_char_buffer), send_handler());
254     socket1.async_send(buffer(const_char_buffer), send_handler());
255     socket1.async_send(null_buffers(), send_handler());
256     socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler());
257     socket1.async_send(buffer(const_char_buffer), in_flags, send_handler());
258     socket1.async_send(null_buffers(), in_flags, send_handler());
259     int i3 = socket1.async_send(buffer(mutable_char_buffer), lazy);
260     (void)i3;
261     int i4 = socket1.async_send(buffer(const_char_buffer), lazy);
262     (void)i4;
263     int i5 = socket1.async_send(null_buffers(), lazy);
264     (void)i5;
265     int i6 = socket1.async_send(buffer(mutable_char_buffer), in_flags, lazy);
266     (void)i6;
267     int i7 = socket1.async_send(buffer(const_char_buffer), in_flags, lazy);
268     (void)i7;
269     int i8 = socket1.async_send(null_buffers(), in_flags, lazy);
270     (void)i8;
271 
272     socket1.send_to(buffer(mutable_char_buffer),
273         ip::icmp::endpoint(ip::icmp::v4(), 0));
274     socket1.send_to(buffer(mutable_char_buffer),
275         ip::icmp::endpoint(ip::icmp::v6(), 0));
276     socket1.send_to(buffer(const_char_buffer),
277         ip::icmp::endpoint(ip::icmp::v4(), 0));
278     socket1.send_to(buffer(const_char_buffer),
279         ip::icmp::endpoint(ip::icmp::v6(), 0));
280     socket1.send_to(null_buffers(),
281         ip::icmp::endpoint(ip::icmp::v4(), 0));
282     socket1.send_to(null_buffers(),
283         ip::icmp::endpoint(ip::icmp::v6(), 0));
284     socket1.send_to(buffer(mutable_char_buffer),
285         ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags);
286     socket1.send_to(buffer(mutable_char_buffer),
287         ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags);
288     socket1.send_to(buffer(const_char_buffer),
289         ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags);
290     socket1.send_to(buffer(const_char_buffer),
291         ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags);
292     socket1.send_to(null_buffers(),
293         ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags);
294     socket1.send_to(null_buffers(),
295         ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags);
296     socket1.send_to(buffer(mutable_char_buffer),
297         ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, ec);
298     socket1.send_to(buffer(mutable_char_buffer),
299         ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, ec);
300     socket1.send_to(buffer(const_char_buffer),
301         ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, ec);
302     socket1.send_to(buffer(const_char_buffer),
303         ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, ec);
304     socket1.send_to(null_buffers(),
305         ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, ec);
306     socket1.send_to(null_buffers(),
307         ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, ec);
308 
309     socket1.async_send_to(buffer(mutable_char_buffer),
310         ip::icmp::endpoint(ip::icmp::v4(), 0), send_handler());
311     socket1.async_send_to(buffer(mutable_char_buffer),
312         ip::icmp::endpoint(ip::icmp::v6(), 0), send_handler());
313     socket1.async_send_to(buffer(const_char_buffer),
314         ip::icmp::endpoint(ip::icmp::v4(), 0), send_handler());
315     socket1.async_send_to(buffer(const_char_buffer),
316         ip::icmp::endpoint(ip::icmp::v6(), 0), send_handler());
317     socket1.async_send_to(null_buffers(),
318         ip::icmp::endpoint(ip::icmp::v4(), 0), send_handler());
319     socket1.async_send_to(null_buffers(),
320         ip::icmp::endpoint(ip::icmp::v6(), 0), send_handler());
321     socket1.async_send_to(buffer(mutable_char_buffer),
322         ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, send_handler());
323     socket1.async_send_to(buffer(mutable_char_buffer),
324         ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, send_handler());
325     socket1.async_send_to(buffer(const_char_buffer),
326         ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, send_handler());
327     socket1.async_send_to(buffer(const_char_buffer),
328         ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, send_handler());
329     socket1.async_send_to(null_buffers(),
330         ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, send_handler());
331     socket1.async_send_to(null_buffers(),
332         ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, send_handler());
333     int i9 = socket1.async_send_to(buffer(mutable_char_buffer),
334         ip::icmp::endpoint(ip::icmp::v4(), 0), lazy);
335     (void)i9;
336     int i10 = socket1.async_send_to(buffer(mutable_char_buffer),
337         ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
338     (void)i10;
339     int i11 = socket1.async_send_to(buffer(const_char_buffer),
340         ip::icmp::endpoint(ip::icmp::v4(), 0), lazy);
341     (void)i11;
342     int i12 = socket1.async_send_to(buffer(const_char_buffer),
343         ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
344     (void)i12;
345     int i13 = socket1.async_send_to(null_buffers(),
346         ip::icmp::endpoint(ip::icmp::v4(), 0), lazy);
347     (void)i13;
348     int i14 = socket1.async_send_to(null_buffers(),
349         ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
350     (void)i14;
351     int i15 = socket1.async_send_to(buffer(mutable_char_buffer),
352         ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, lazy);
353     (void)i15;
354     int i16 = socket1.async_send_to(buffer(mutable_char_buffer),
355         ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, lazy);
356     (void)i16;
357     int i17 = socket1.async_send_to(buffer(const_char_buffer),
358         ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, lazy);
359     (void)i17;
360     int i18 = socket1.async_send_to(buffer(const_char_buffer),
361         ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, lazy);
362     (void)i18;
363     int i19 = socket1.async_send_to(null_buffers(),
364         ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, lazy);
365     (void)i19;
366     int i20 = socket1.async_send_to(null_buffers(),
367         ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, lazy);
368     (void)i20;
369 
370     socket1.receive(buffer(mutable_char_buffer));
371     socket1.receive(null_buffers());
372     socket1.receive(buffer(mutable_char_buffer), in_flags);
373     socket1.receive(null_buffers(), in_flags);
374     socket1.receive(buffer(mutable_char_buffer), in_flags, ec);
375     socket1.receive(null_buffers(), in_flags, ec);
376 
377     socket1.async_receive(buffer(mutable_char_buffer), receive_handler());
378     socket1.async_receive(null_buffers(), receive_handler());
379     socket1.async_receive(buffer(mutable_char_buffer), in_flags,
380         receive_handler());
381     socket1.async_receive(null_buffers(), in_flags, receive_handler());
382     int i21 = socket1.async_receive(buffer(mutable_char_buffer), lazy);
383     (void)i21;
384     int i22 = socket1.async_receive(null_buffers(), lazy);
385     (void)i22;
386     int i23 = socket1.async_receive(buffer(mutable_char_buffer),
387         in_flags, lazy);
388     (void)i23;
389     int i24 = socket1.async_receive(null_buffers(), in_flags, lazy);
390     (void)i24;
391 
392     ip::icmp::endpoint endpoint;
393     socket1.receive_from(buffer(mutable_char_buffer), endpoint);
394     socket1.receive_from(null_buffers(), endpoint);
395     socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags);
396     socket1.receive_from(null_buffers(), endpoint, in_flags);
397     socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags, ec);
398     socket1.receive_from(null_buffers(), endpoint, in_flags, ec);
399 
400     socket1.async_receive_from(buffer(mutable_char_buffer),
401         endpoint, receive_handler());
402     socket1.async_receive_from(null_buffers(),
403         endpoint, receive_handler());
404     socket1.async_receive_from(buffer(mutable_char_buffer),
405         endpoint, in_flags, receive_handler());
406     socket1.async_receive_from(null_buffers(),
407         endpoint, in_flags, receive_handler());
408     int i25 = socket1.async_receive_from(buffer(mutable_char_buffer),
409         endpoint, lazy);
410     (void)i25;
411     int i26 = socket1.async_receive_from(null_buffers(),
412         endpoint, lazy);
413     (void)i26;
414     int i27 = socket1.async_receive_from(buffer(mutable_char_buffer),
415         endpoint, in_flags, lazy);
416     (void)i27;
417     int i28 = socket1.async_receive_from(null_buffers(),
418         endpoint, in_flags, lazy);
419     (void)i28;
420   }
421   catch (std::exception&)
422   {
423   }
424 }
425 
426 } // namespace ip_icmp_socket_compile
427 
428 //------------------------------------------------------------------------------
429 
430 // ip_icmp_resolver_compile test
431 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
432 // The following test checks that all public member functions on the class
433 // ip::icmp::resolver compile and link correctly. Runtime failures are ignored.
434 
435 namespace ip_icmp_resolver_compile {
436 
437 struct resolve_handler
438 {
resolve_handlerip_icmp_resolver_compile::resolve_handler439   resolve_handler() {}
operator ()ip_icmp_resolver_compile::resolve_handler440   void operator()(const asio::error_code&,
441       asio::ip::icmp::resolver::results_type) {}
442 #if defined(ASIO_HAS_MOVE)
resolve_handlerip_icmp_resolver_compile::resolve_handler443   resolve_handler(resolve_handler&&) {}
444 private:
445   resolve_handler(const resolve_handler&);
446 #endif // defined(ASIO_HAS_MOVE)
447 };
448 
test()449 void test()
450 {
451   using namespace asio;
452   namespace ip = asio::ip;
453 
454   try
455   {
456     io_context ioc;
457     const io_context::executor_type ioc_ex = ioc.get_executor();
458     archetypes::lazy_handler lazy;
459     asio::error_code ec;
460 #if !defined(ASIO_NO_DEPRECATED)
461     ip::icmp::resolver::query q(ip::icmp::v4(), "localhost", "0");
462 #endif // !defined(ASIO_NO_DEPRECATED)
463     ip::icmp::endpoint e(ip::address_v4::loopback(), 0);
464 
465     // basic_resolver constructors.
466 
467     ip::icmp::resolver resolver(ioc);
468     ip::icmp::resolver resolver2(ioc_ex);
469 
470 #if defined(ASIO_HAS_MOVE)
471     ip::icmp::resolver resolver3(std::move(resolver));
472 #endif // defined(ASIO_HAS_MOVE)
473 
474     // basic_resolver operators.
475 
476 #if defined(ASIO_HAS_MOVE)
477     resolver = ip::icmp::resolver(ioc);
478     resolver = std::move(resolver3);
479 #endif // defined(ASIO_HAS_MOVE)
480 
481     // basic_io_object functions.
482 
483     ip::icmp::resolver::executor_type ex = resolver.get_executor();
484     (void)ex;
485 
486     // basic_resolver functions.
487 
488     resolver.cancel();
489 
490 #if !defined(ASIO_NO_DEPRECATED)
491     ip::icmp::resolver::results_type results1 = resolver.resolve(q);
492     (void)results1;
493 
494     ip::icmp::resolver::results_type results2 = resolver.resolve(q, ec);
495     (void)results2;
496 #endif // !defined(ASIO_NO_DEPRECATED)
497 
498     ip::icmp::resolver::results_type results3 = resolver.resolve("", "");
499     (void)results3;
500 
501     ip::icmp::resolver::results_type results4 = resolver.resolve("", "", ec);
502     (void)results4;
503 
504     ip::icmp::resolver::results_type results5 =
505       resolver.resolve("", "", ip::icmp::resolver::flags());
506     (void)results5;
507 
508     ip::icmp::resolver::results_type results6 =
509       resolver.resolve("", "", ip::icmp::resolver::flags(), ec);
510     (void)results6;
511 
512     ip::icmp::resolver::results_type results7 =
513       resolver.resolve(ip::icmp::v4(), "", "");
514     (void)results7;
515 
516     ip::icmp::resolver::results_type results8 =
517       resolver.resolve(ip::icmp::v4(), "", "", ec);
518     (void)results8;
519 
520     ip::icmp::resolver::results_type results9 =
521       resolver.resolve(ip::icmp::v4(), "", "", ip::icmp::resolver::flags());
522     (void)results9;
523 
524     ip::icmp::resolver::results_type results10 =
525       resolver.resolve(ip::icmp::v4(), "", "", ip::icmp::resolver::flags(), ec);
526     (void)results10;
527 
528     ip::icmp::resolver::results_type results11 = resolver.resolve(e);
529     (void)results11;
530 
531     ip::icmp::resolver::results_type results12 = resolver.resolve(e, ec);
532     (void)results12;
533 
534 #if !defined(ASIO_NO_DEPRECATED)
535     resolver.async_resolve(q, resolve_handler());
536     int i1 = resolver.async_resolve(q, lazy);
537     (void)i1;
538 #endif // !defined(ASIO_NO_DEPRECATED)
539 
540     resolver.async_resolve("", "", resolve_handler());
541     int i2 = resolver.async_resolve("", "", lazy);
542     (void)i2;
543 
544     resolver.async_resolve("", "",
545         ip::icmp::resolver::flags(), resolve_handler());
546     int i3 = resolver.async_resolve("", "",
547         ip::icmp::resolver::flags(), lazy);
548     (void)i3;
549     resolver.async_resolve(ip::icmp::v4(), "", "", resolve_handler());
550     int i4 = resolver.async_resolve(ip::icmp::v4(), "", "", lazy);
551     (void)i4;
552 
553     resolver.async_resolve(ip::icmp::v4(),
554         "", "", ip::icmp::resolver::flags(), resolve_handler());
555     int i5 = resolver.async_resolve(ip::icmp::v4(),
556         "", "", ip::icmp::resolver::flags(), lazy);
557     (void)i5;
558 
559     resolver.async_resolve(e, resolve_handler());
560     int i6 = resolver.async_resolve(e, lazy);
561     (void)i6;
562   }
563   catch (std::exception&)
564   {
565   }
566 }
567 
568 } // namespace ip_icmp_resolver_compile
569 
570 //------------------------------------------------------------------------------
571 
572 ASIO_TEST_SUITE
573 (
574   "ip/icmp",
575   ASIO_TEST_CASE(ip_icmp_socket_compile::test)
576   ASIO_TEST_CASE(ip_icmp_resolver_compile::test)
577 )
578