proxygen
IPAddressTest Struct Reference
Inheritance diagram for IPAddressTest:

Public Member Functions

void ExpectIsValid (const IPAddress &addr)
 

Detailed Description

Definition at line 127 of file IPAddressTest.cpp.

Member Function Documentation

void IPAddressTest::ExpectIsValid ( const IPAddress &  addr)
inline

Definition at line 128 of file IPAddressTest.cpp.

References AddressData::address, EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, AddressData::parseAddress4(), AddressData::parseAddress6(), and AddressData::version.

128  {
129  AddressData param = GetParam();
130  EXPECT_EQ(param.version, addr.version());
131  EXPECT_EQ(param.address, addr.str());
132  if (param.version == 4) {
133  in_addr v4addr = AddressData::parseAddress4(param.address);
134  EXPECT_EQ(0, memcmp(&v4addr, addr.asV4().toByteArray().data(), 4));
135  EXPECT_TRUE(addr.isV4());
136  EXPECT_FALSE(addr.isV6());
137  } else {
138  in6_addr v6addr = AddressData::parseAddress6(param.address);
139  EXPECT_EQ(0, memcmp(&v6addr, addr.asV6().toByteArray().data(), 16));
140  EXPECT_TRUE(addr.isV6());
141  EXPECT_FALSE(addr.isV4());
142  }
143  }
static in6_addr parseAddress6(const std::string &src)
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
std::string address
static in_addr parseAddress4(const std::string &src)
uint8_t version
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
#define EXPECT_FALSE(condition)
Definition: gtest.h:1862
ThreadPoolListHook * addr

The documentation for this struct was generated from the following file: