Commit | Line | Data |
---|---|---|
c5c55889 GMF |
1 | /* |
2 | The software in this package is distributed under the GNU General | |
3 | Public License version 2 (with a special exception described below). | |
4 | ||
5 | A copy of GNU General Public License (GPL) is included in this distribution, | |
6 | in the file COPYING.GPL. | |
7 | ||
8 | As a special exception, if other files instantiate templates or use macros | |
9 | or inline functions from this file, or you compile this file and link it | |
10 | with other works to produce a work based on this file, this file | |
11 | does not by itself cause the resulting work to be covered | |
12 | by the GNU General Public License. | |
13 | ||
14 | However the source code for this file must still be made available | |
15 | in accordance with section (3) of the GNU General Public License. | |
16 | ||
17 | This exception does not invalidate any other reasons why a work based | |
18 | on this file might be covered by the GNU General Public License. | |
19 | */ | |
20 | ||
21 | #define BOOST_TEST_MAIN | |
22 | #define BOOST_TEST_DYN_LINK | |
23 | ||
24 | #include <boost/test/unit_test.hpp> | |
25 | ||
26 | #include "host/pingprotocol.h" | |
27 | ||
05495299 | 28 | BOOST_AUTO_TEST_SUITE( TestPingProtocol ) |
c5c55889 GMF |
29 | |
30 | BOOST_AUTO_TEST_CASE( lowercase ) | |
31 | { | |
32 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "icmp" ), PingProtocol_ICMP ); | |
33 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "tcp" ), PingProtocol_TCP ); | |
34 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "icmpv6" ), PingProtocol_ICMPv6 ); | |
35 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "tcp_ipv6" ), PingProtocol_TCP_IPv6 ); | |
36 | } | |
37 | ||
38 | BOOST_AUTO_TEST_CASE( uppercase ) | |
39 | { | |
40 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "ICMP" ), PingProtocol_ICMP ); | |
41 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "TCP" ), PingProtocol_TCP ); | |
42 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "ICMPV6" ), PingProtocol_ICMPv6 ); | |
43 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "TCP_IPV6" ), PingProtocol_TCP_IPv6 ); | |
44 | } | |
45 | ||
46 | BOOST_AUTO_TEST_CASE( mixed_case ) | |
47 | { | |
48 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "IcMp" ), PingProtocol_ICMP ); | |
49 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "TcP" ), PingProtocol_TCP ); | |
50 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "IcmpV6" ), PingProtocol_ICMPv6 ); | |
51 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "Tcp_Ipv6" ), PingProtocol_TCP_IPv6 ); | |
52 | } | |
53 | ||
54 | BOOST_AUTO_TEST_CASE( misspelled ) | |
55 | { | |
56 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "when" ), PingProtocol_ICMP ); | |
57 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "the" ), PingProtocol_ICMP ); | |
58 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "word" ), PingProtocol_ICMP ); | |
59 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "is" ), PingProtocol_ICMP ); | |
60 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "wrong" ), PingProtocol_ICMP ); | |
61 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "stick" ), PingProtocol_ICMP ); | |
62 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "to" ), PingProtocol_ICMP ); | |
63 | BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "ICMP" ), PingProtocol_ICMP ); | |
64 | } | |
65 | ||
66 | BOOST_AUTO_TEST_SUITE_END() |