--- /dev/null
+/*
+The software in this package is distributed under the GNU General
+Public License version 2 (with a special exception described below).
+
+A copy of GNU General Public License (GPL) is included in this distribution,
+in the file COPYING.GPL.
+
+As a special exception, if other files instantiate templates or use macros
+or inline functions from this file, or you compile this file and link it
+with other works to produce a work based on this file, this file
+does not by itself cause the resulting work to be covered
+by the GNU General Public License.
+
+However the source code for this file must still be made available
+in accordance with section (3) of the GNU General Public License.
+
+This exception does not invalidate any other reasons why a work based
+on this file might be covered by the GNU General Public License.
+*/
+
+#define BOOST_TEST_MAIN
+#define BOOST_TEST_DYN_LINK
+
+#include <boost/test/unit_test.hpp>
+
+#include "host/pingprotocol.h"
+
+BOOST_AUTO_TEST_SUITE( TestDnsResolver )
+
+BOOST_AUTO_TEST_CASE( lowercase )
+{
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "icmp" ), PingProtocol_ICMP );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "tcp" ), PingProtocol_TCP );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "icmpv6" ), PingProtocol_ICMPv6 );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "tcp_ipv6" ), PingProtocol_TCP_IPv6 );
+}
+
+BOOST_AUTO_TEST_CASE( uppercase )
+{
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "ICMP" ), PingProtocol_ICMP );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "TCP" ), PingProtocol_TCP );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "ICMPV6" ), PingProtocol_ICMPv6 );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "TCP_IPV6" ), PingProtocol_TCP_IPv6 );
+}
+
+BOOST_AUTO_TEST_CASE( mixed_case )
+{
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "IcMp" ), PingProtocol_ICMP );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "TcP" ), PingProtocol_TCP );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "IcmpV6" ), PingProtocol_ICMPv6 );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "Tcp_Ipv6" ), PingProtocol_TCP_IPv6 );
+}
+
+BOOST_AUTO_TEST_CASE( misspelled )
+{
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "when" ), PingProtocol_ICMP );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "the" ), PingProtocol_ICMP );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "word" ), PingProtocol_ICMP );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "is" ), PingProtocol_ICMP );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "wrong" ), PingProtocol_ICMP );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "stick" ), PingProtocol_ICMP );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "to" ), PingProtocol_ICMP );
+ BOOST_CHECK_EQUAL( get_ping_protocol_from_string( "ICMP" ), PingProtocol_ICMP );
+}
+
+BOOST_AUTO_TEST_SUITE_END()