From 3ec8ab868e8025b4b5935c157cd12332a9471a81 Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Sat, 23 May 2015 12:48:57 -0700 Subject: [PATCH] Use different IP addresses on IP tests depending on OS. --- tests/src/ip.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/src/ip.cpp b/tests/src/ip.cpp index 4f95cc7..5768f37 100644 --- a/tests/src/ip.cpp +++ b/tests/src/ip.cpp @@ -14,6 +14,12 @@ using namespace std; using namespace Tins; +#ifdef _WIN32 + #define TINS_DEFAULT_TEST_IP "0.0.0.0" +#else + #define TINS_DEFAULT_TEST_IP "127.0.0.1" +#endif + class IPTest : public testing::Test { public: static const uint8_t expected_packet[], fragmented_packet[], @@ -660,21 +666,21 @@ TEST_F(IPTest, ConstructorFromBuffer) { } TEST_F(IPTest, StackedProtocols) { - IP ip = IP("127.0.0.1") / TCP(); + IP ip = IP(TINS_DEFAULT_TEST_IP) / TCP(); IP::serialization_type buffer = ip.serialize(); EXPECT_TRUE(IP(&buffer[0], (uint32_t)buffer.size()).find_pdu() != NULL); - ip = IP("127.0.0.1") / UDP(); + ip = IP(TINS_DEFAULT_TEST_IP) / UDP(); buffer = ip.serialize(); EXPECT_TRUE(IP(&buffer[0], (uint32_t)buffer.size()).find_pdu() != NULL); - ip = IP("127.0.0.1") / ICMP(); + ip = IP(TINS_DEFAULT_TEST_IP) / ICMP(); buffer = ip.serialize(); EXPECT_TRUE(IP(&buffer[0], (uint32_t)buffer.size()).find_pdu() != NULL); } TEST_F(IPTest, SpoofedOptions) { - IP pdu("127.0.0.1"); + IP pdu(TINS_DEFAULT_TEST_IP); uint8_t a[] = { 1,2,3,4,5,6 }; pdu.add_option( IP::option(IP::NOOP, 250, a, a + sizeof(a))