proxygen
|
#include <sys/types.h>
#include <string>
#include <folly/Format.h>
#include <folly/IPAddress.h>
#include <folly/MacAddress.h>
#include <folly/String.h>
#include <folly/container/BitIterator.h>
#include <folly/detail/IPAddressSource.h>
#include <folly/lang/Bits.h>
#include <folly/portability/GMock.h>
#include <folly/portability/GTest.h>
Go to the source code of this file.
Classes | |
struct | AddressData |
struct | AddressFlags |
struct | MaskData |
struct | MaskBoundaryData |
struct | SerializeData |
struct | IPAddressTest |
struct | IPAddressFlagTest |
struct | IPAddressCtorTest |
struct | IPAddressCtorBinaryTest |
struct | IPAddressMappedTest |
struct | IPAddressMaskTest |
struct | IPAddressMaskBoundaryTest |
struct | IPAddressSerializeTest |
struct | IPAddressByteAccessorTest |
struct | IPAddressBitAccessorTest |
struct | StringTestParam |
struct | TryFromStringTest |
Typedefs | |
typedef std::vector< uint8_t > | ByteVector |
using | ByteArray8 = std::array< uint8_t, 8 > |
Functions | |
TEST (IPAddress, CodeExample) | |
TEST (IPAddress, Scope) | |
TEST (IPAddress, ScopeNumeric) | |
TEST (IPAddress, Ordering) | |
TEST (IPAddress, InvalidAddressFamilyExceptions) | |
TEST (IPAddress, TryCreateNetwork) | |
TEST (IPAddress, CreateNetworkExceptions) | |
TEST (IPAddress, Assignment) | |
TEST (IPAddress, CtorDefault) | |
TEST (IPAddressV4, validate) | |
TEST (IPAddressV6, validate) | |
TEST (IPAddress, validate) | |
TEST_P (IPAddressTest, CtorAddress) | |
TEST_P (IPAddressTest, CtorBinary) | |
TEST_P (IPAddressTest, CtorString) | |
TEST (IPAddress, CtorSockaddr) | |
TEST (IPAddress, ToSockaddrStorage) | |
TEST_P (TryFromStringTest, IPAddress) | |
TEST_P (TryFromStringTest, IPAddressV4) | |
TEST_P (TryFromStringTest, IPAddressV6) | |
TEST (IPAddress, ToString) | |
TEST (IPaddress, toInverseArpaName) | |
TEST (IPaddress, fromInverseArpaName) | |
TEST_P (IPAddressCtorTest, InvalidCreation) | |
TEST_P (IPAddressCtorBinaryTest, InvalidBinary) | |
TEST (IPAddressSource, ToHex) | |
TEST (IPAddress, ToFullyQualifiedFb) | |
TEST (IPAddress, ToFullyQualifiedLocal) | |
TEST (IPAddress, ToFullyQualifiedAppendV6) | |
TEST (IPAddress, ToFullyQualifiedAppendV4) | |
TEST (IPAddress, ToFullyQualifiedSizeV6) | |
TEST (IPAddress, MaxToFullyQualifiedSizeV4) | |
TEST_P (IPAddressMappedTest, MappedEqual) | |
TEST_P (IPAddressMaskTest, Masks) | |
TEST_P (IPAddressMaskTest, InSubnet) | |
TEST_P (IPAddressMaskBoundaryTest, NonMaskedSubnet) | |
TEST (IPAddress, UnitializedEqual) | |
TEST (IPAddress, InSubnetWith6to4) | |
TEST (IPAddress, getIPv6For6To4) | |
TEST (IPAddress, InvalidMask) | |
TEST (IPAddress, V6Types) | |
TEST (IPAddress, ToLong) | |
TEST (IPAddress, fromBinaryV4) | |
TEST (IPAddress, toBinaryV4) | |
TEST (IPAddress, fromBinaryV6) | |
TEST (IPAddress, toBinaryV6) | |
TEST_P (IPAddressFlagTest, IsLoopback) | |
TEST_P (IPAddressFlagTest, IsPrivate) | |
TEST_P (IPAddressFlagTest, IsNonroutable) | |
TEST_P (IPAddressFlagTest, IsZero) | |
TEST_P (IPAddressFlagTest, IsLinkLocal) | |
TEST (IPAddress, CreateLinkLocal) | |
TEST_P (IPAddressFlagTest, IsLinkLocalBroadcast) | |
TEST (IPAddress, SolicitedNodeAddress) | |
TEST_P (IPAddressByteAccessorTest, CheckBytes) | |
TEST_P (IPAddressBitAccessorTest, CheckBits) | |
TEST (IPAddress, InvalidByteAccess) | |
TEST (IPAddress, InvalidBBitAccess) | |
TEST (IPAddress, StringFormat) | |
TEST (IPAddress, getMacAddressFromLinkLocal) | |
TEST (IPAddress, getMacAddressFromLinkLocal_Negative) | |
TEST (IPAddress, getMacAddressFromEUI64) | |
TEST (IPAddress, getMacAddressFromEUI64_Negative) | |
TEST (IPAddress, LongestCommonPrefix) | |
INSTANTIATE_TEST_CASE_P (IPAddress, IPAddressTest,::testing::ValuesIn(validAddressProvider)) | |
INSTANTIATE_TEST_CASE_P (IPAddress, IPAddressFlagTest,::testing::ValuesIn(flagProvider)) | |
INSTANTIATE_TEST_CASE_P (IPAddress, IPAddressMappedTest,::testing::ValuesIn(mapProvider)) | |
INSTANTIATE_TEST_CASE_P (IPAddress, IPAddressCtorTest,::testing::ValuesIn(invalidAddressProvider)) | |
INSTANTIATE_TEST_CASE_P (IPAddress, IPAddressCtorBinaryTest,::testing::ValuesIn(invalidBinaryProvider)) | |
INSTANTIATE_TEST_CASE_P (IPAddress, IPAddressMaskTest,::testing::ValuesIn(masksProvider)) | |
INSTANTIATE_TEST_CASE_P (IPAddress, IPAddressMaskBoundaryTest,::testing::ValuesIn(maskBoundaryProvider)) | |
INSTANTIATE_TEST_CASE_P (IPAddress, IPAddressByteAccessorTest,::testing::ValuesIn(validAddressProvider)) | |
INSTANTIATE_TEST_CASE_P (IPAddress, IPAddressBitAccessorTest,::testing::ValuesIn(validAddressProvider)) | |
INSTANTIATE_TEST_CASE_P (IPAddress, TryFromStringTest,::testing::ValuesIn(TryFromStringTest::ipInOutProvider())) | |
TEST (IPAddressV4, fetchMask) | |
TEST (IPAddressV6, fetchMask) | |
using ByteArray8 = std::array<uint8_t, 8> |
Definition at line 975 of file IPAddressTest.cpp.
typedef std::vector<uint8_t> ByteVector |
Definition at line 34 of file IPAddressTest.cpp.
INSTANTIATE_TEST_CASE_P | ( | IPAddress | , |
IPAddressTest | , | ||
::testing::ValuesIn(validAddressProvider) | |||
) |
INSTANTIATE_TEST_CASE_P | ( | IPAddress | , |
IPAddressFlagTest | , | ||
::testing::ValuesIn(flagProvider) | |||
) |
INSTANTIATE_TEST_CASE_P | ( | IPAddress | , |
IPAddressMappedTest | , | ||
::testing::ValuesIn(mapProvider) | |||
) |
INSTANTIATE_TEST_CASE_P | ( | IPAddress | , |
IPAddressCtorTest | , | ||
::testing::ValuesIn(invalidAddressProvider) | |||
) |
INSTANTIATE_TEST_CASE_P | ( | IPAddress | , |
IPAddressCtorBinaryTest | , | ||
::testing::ValuesIn(invalidBinaryProvider) | |||
) |
INSTANTIATE_TEST_CASE_P | ( | IPAddress | , |
IPAddressMaskTest | , | ||
::testing::ValuesIn(masksProvider) | |||
) |
INSTANTIATE_TEST_CASE_P | ( | IPAddress | , |
IPAddressMaskBoundaryTest | , | ||
::testing::ValuesIn(maskBoundaryProvider) | |||
) |
INSTANTIATE_TEST_CASE_P | ( | IPAddress | , |
IPAddressByteAccessorTest | , | ||
::testing::ValuesIn(validAddressProvider) | |||
) |
INSTANTIATE_TEST_CASE_P | ( | IPAddress | , |
IPAddressBitAccessorTest | , | ||
::testing::ValuesIn(validAddressProvider) | |||
) |
INSTANTIATE_TEST_CASE_P | ( | IPAddress | , |
TryFromStringTest | , | ||
::testing::ValuesIn(TryFromStringTest::ipInOutProvider()) | |||
) |
TEST | ( | IPAddress | , |
CodeExample | |||
) |
Definition at line 189 of file IPAddressTest.cpp.
References ASSERT_FALSE, ASSERT_TRUE, EXPECT_EQ, EXPECT_FALSE, and EXPECT_TRUE.
TEST | ( | IPAddress | , |
Scope | |||
) |
Definition at line 215 of file IPAddressTest.cpp.
References EXPECT_EQ, EXPECT_NE, EXPECT_TRUE, folly::IPAddressV6::setScopeId(), folly::IPAddressV6::str(), and folly::IPAddressV6::toSockAddr().
TEST | ( | IPAddress | , |
ScopeNumeric | |||
) |
Definition at line 233 of file IPAddressTest.cpp.
References EXPECT_EQ, EXPECT_NE, EXPECT_TRUE, folly::IPAddressV6::setScopeId(), folly::IPAddressV6::str(), and folly::IPAddressV6::toSockAddr().
TEST | ( | IPAddress | , |
Ordering | |||
) |
TEST | ( | IPAddress | , |
InvalidAddressFamilyExceptions | |||
) |
TEST | ( | IPAddress | , |
TryCreateNetwork | |||
) |
Definition at line 283 of file IPAddressTest.cpp.
References ASSERT_TRUE, folly::CIDR_MISMATCH, folly::pushmi::operators::error(), EXPECT_EQ, folly::INVALID_DEFAULT_CIDR, folly::INVALID_IP, and folly::INVALID_IP_SLASH_CIDR.
TEST | ( | IPAddress | , |
CreateNetworkExceptions | |||
) |
TEST | ( | IPAddress | , |
Assignment | |||
) |
Definition at line 370 of file IPAddressTest.cpp.
References addr, EXPECT_EQ, and EXPECT_TRUE.
TEST | ( | IPAddress | , |
CtorDefault | |||
) |
Definition at line 417 of file IPAddressTest.cpp.
References EXPECT_EQ.
TEST | ( | IPAddressV4 | , |
validate | |||
) |
Definition at line 424 of file IPAddressTest.cpp.
References EXPECT_FALSE, EXPECT_TRUE, and folly::IPAddressV4::validate().
TEST | ( | IPAddressV6 | , |
validate | |||
) |
Definition at line 430 of file IPAddressTest.cpp.
References EXPECT_FALSE, EXPECT_TRUE, and folly::IPAddressV6::validate().
TEST | ( | IPAddress | , |
validate | |||
) |
TEST | ( | IPAddress | , |
CtorSockaddr | |||
) |
Definition at line 499 of file IPAddressTest.cpp.
References addr, EXPECT_EQ, EXPECT_THROW, and EXPECT_TRUE.
TEST | ( | IPAddress | , |
ToSockaddrStorage | |||
) |
Definition at line 548 of file IPAddressTest.cpp.
References addr, ASSERT_EQ, ASSERT_TRUE, EXPECT_EQ, EXPECT_GT, and EXPECT_THROW.
TEST | ( | IPAddress | , |
ToString | |||
) |
Definition at line 628 of file IPAddressTest.cpp.
References EXPECT_EQ.
TEST | ( | IPaddress | , |
toInverseArpaName | |||
) |
Definition at line 654 of file IPAddressTest.cpp.
References EXPECT_EQ, folly::sformat(), and folly::IPAddressV4::toInverseArpaName().
TEST | ( | IPaddress | , |
fromInverseArpaName | |||
) |
Definition at line 665 of file IPAddressTest.cpp.
References EXPECT_EQ, folly::IPAddressV4::fromInverseArpaName(), folly::IPAddressV6::fromInverseArpaName(), and folly::sformat().
TEST | ( | IPAddressSource | , |
ToHex | |||
) |
Definition at line 698 of file IPAddressTest.cpp.
References folly::data(), EXPECT_EQ, and folly::detail::Bytes::toHex().
TEST | ( | IPAddress | , |
ToFullyQualifiedFb | |||
) |
TEST | ( | IPAddress | , |
ToFullyQualifiedLocal | |||
) |
TEST | ( | IPAddress | , |
ToFullyQualifiedAppendV6 | |||
) |
TEST | ( | IPAddress | , |
ToFullyQualifiedAppendV4 | |||
) |
TEST | ( | IPAddress | , |
ToFullyQualifiedSizeV6 | |||
) |
Definition at line 729 of file IPAddressTest.cpp.
References EXPECT_EQ, and folly::IPAddressV6::kToFullyQualifiedSize.
TEST | ( | IPAddress | , |
MaxToFullyQualifiedSizeV4 | |||
) |
Definition at line 734 of file IPAddressTest.cpp.
References EXPECT_EQ, and folly::IPAddressV4::kMaxToFullyQualifiedSize.
TEST | ( | IPAddress | , |
UnitializedEqual | |||
) |
TEST | ( | IPAddress | , |
InSubnetWith6to4 | |||
) |
TEST | ( | IPAddress | , |
getIPv6For6To4 | |||
) |
Definition at line 830 of file IPAddressTest.cpp.
References EXPECT_EQ, EXPECT_TRUE, and folly::IPAddressV4::getIPv6For6To4().
TEST | ( | IPAddress | , |
InvalidMask | |||
) |
Definition at line 846 of file IPAddressTest.cpp.
References EXPECT_THROW, and tc.
TEST | ( | IPAddress | , |
V6Types | |||
) |
Definition at line 859 of file IPAddressTest.cpp.
References EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, FAIL, folly::pushmi::detail::t, and tc.
TEST | ( | IPAddress | , |
ToLong | |||
) |
Definition at line 902 of file IPAddressTest.cpp.
References EXPECT_EQ, EXPECT_TRUE, and tc.
TEST | ( | IPAddress | , |
fromBinaryV4 | |||
) |
Definition at line 922 of file IPAddressTest.cpp.
References ASSERT_TRUE, folly::Endian::big(), folly::data(), EXPECT_EQ, EXPECT_THROW, EXPECT_TRUE, folly::IPAddressV4::fromBinary(), SCOPED_TRACE, tc, folly::IPAddressV4::tryFromBinary(), uint32_t, and uint8_t.
TEST | ( | IPAddress | , |
toBinaryV4 | |||
) |
Definition at line 959 of file IPAddressTest.cpp.
References folly::Endian::big(), folly::data(), EXPECT_EQ, folly::IPAddressV4::fromBinary(), SCOPED_TRACE, tc, uint32_t, and uint8_t.
TEST | ( | IPAddress | , |
fromBinaryV6 | |||
) |
Definition at line 1015 of file IPAddressTest.cpp.
References ASSERT_TRUE, folly::data(), EXPECT_EQ, EXPECT_THROW, EXPECT_TRUE, folly::IPAddressV6::fromBinary(), SCOPED_TRACE, tc, folly::IPAddressV6::tryFromBinary(), and uint8_t.
TEST | ( | IPAddress | , |
toBinaryV6 | |||
) |
Definition at line 1047 of file IPAddressTest.cpp.
References EXPECT_EQ, folly::IPAddressV6::fromBinary(), SCOPED_TRACE, and tc.
TEST | ( | IPAddress | , |
CreateLinkLocal | |||
) |
Definition at line 1096 of file IPAddressTest.cpp.
References addr, EXPECT_EQ, and folly::IPAddressV6::LINK_LOCAL.
TEST | ( | IPAddress | , |
SolicitedNodeAddress | |||
) |
Definition at line 1111 of file IPAddressTest.cpp.
References EXPECT_EQ.
TEST | ( | IPAddress | , |
InvalidByteAccess | |||
) |
TEST | ( | IPAddress | , |
InvalidBBitAccess | |||
) |
TEST | ( | IPAddress | , |
StringFormat | |||
) |
Definition at line 1217 of file IPAddressTest.cpp.
References EXPECT_EQ, folly::detail::fastIpv4ToString(), folly::detail::fastIpv6ToString(), i, and folly::pushmi::detail::t.
TEST | ( | IPAddress | , |
getMacAddressFromLinkLocal | |||
) |
Definition at line 1235 of file IPAddressTest.cpp.
References EXPECT_EQ, EXPECT_TRUE, and folly::IPAddressV6::getMacAddressFromLinkLocal().
TEST | ( | IPAddress | , |
getMacAddressFromLinkLocal_Negative | |||
) |
Definition at line 1241 of file IPAddressTest.cpp.
References EXPECT_FALSE, and folly::IPAddressV6::getMacAddressFromLinkLocal().
TEST | ( | IPAddress | , |
getMacAddressFromEUI64 | |||
) |
Definition at line 1252 of file IPAddressTest.cpp.
References EXPECT_EQ, EXPECT_TRUE, and folly::IPAddressV6::getMacAddressFromEUI64().
TEST | ( | IPAddress | , |
getMacAddressFromEUI64_Negative | |||
) |
Definition at line 1261 of file IPAddressTest.cpp.
References EXPECT_FALSE, and folly::IPAddressV6::getMacAddressFromEUI64().
TEST | ( | IPAddress | , |
LongestCommonPrefix | |||
) |
Definition at line 1266 of file IPAddressTest.cpp.
References folly::IPAddressV4::bitCount(), folly::IPAddressV6::bitCount(), EXPECT_EQ, EXPECT_THROW, folly::IPAddressV4::longestCommonPrefix(), folly::IPAddressV6::longestCommonPrefix(), and prefix().
TEST | ( | IPAddressV4 | , |
fetchMask | |||
) |
Definition at line 1574 of file IPAddressTest.cpp.
References testing::ElementsAreArray(), EXPECT_THAT, and folly::IPAddressV4::fetchMask().
TEST | ( | IPAddressV6 | , |
fetchMask | |||
) |
Definition at line 1596 of file IPAddressTest.cpp.
References testing::ElementsAreArray(), EXPECT_THAT, folly::IPAddressV6::fetchMask(), and join8.
TEST_P | ( | IPAddressTest | , |
CtorAddress | |||
) |
Definition at line 447 of file IPAddressTest.cpp.
References AddressData::address, AddressData::bytes, EXPECT_EQ, folly::detail::Bytes::mkAddress4(), folly::detail::Bytes::mkAddress6(), and AddressData::version.
TEST_P | ( | IPAddressTest | , |
CtorBinary | |||
) |
Definition at line 464 of file IPAddressTest.cpp.
References AddressData::address, EXPECT_EQ, AddressData::parseAddress4(), AddressData::parseAddress6(), and AddressData::version.
TEST_P | ( | IPAddressTest | , |
CtorString | |||
) |
Definition at line 481 of file IPAddressTest.cpp.
References AddressData::address, EXPECT_THROW, and AddressData::version.
TEST_P | ( | TryFromStringTest | , |
IPAddress | |||
) |
Definition at line 590 of file IPAddressTest.cpp.
References EXPECT_EQ, EXPECT_TRUE, folly::INVALID_IP, and folly::UNSUPPORTED_ADDR_FAMILY.
TEST_P | ( | TryFromStringTest | , |
IPAddressV4 | |||
) |
Definition at line 604 of file IPAddressTest.cpp.
References EXPECT_EQ, EXPECT_TRUE, folly::INVALID_IP, and folly::IPAddressV4::tryFromString().
TEST_P | ( | TryFromStringTest | , |
IPAddressV6 | |||
) |
Definition at line 616 of file IPAddressTest.cpp.
References EXPECT_EQ, EXPECT_TRUE, folly::INVALID_IP, and folly::IPAddressV6::tryFromString().
TEST_P | ( | IPAddressCtorTest | , |
InvalidCreation | |||
) |
TEST_P | ( | IPAddressCtorBinaryTest | , |
InvalidBinary | |||
) |
Definition at line 685 of file IPAddressTest.cpp.
References EXPECT_THROW, EXPECT_TRUE, folly::IPAddressV4::fromBinary(), folly::IPAddressV6::fromBinary(), folly::IPAddressV4::tryFromBinary(), and folly::IPAddressV6::tryFromBinary().
TEST_P | ( | IPAddressMappedTest | , |
MappedEqual | |||
) |
Definition at line 741 of file IPAddressTest.cpp.
References EXPECT_EQ, EXPECT_TRUE, and folly::gen::mapped().
TEST_P | ( | IPAddressMaskTest | , |
Masks | |||
) |
TEST_P | ( | IPAddressMaskTest | , |
InSubnet | |||
) |
TEST_P | ( | IPAddressMaskBoundaryTest | , |
NonMaskedSubnet | |||
) |
TEST_P | ( | IPAddressFlagTest | , |
IsLoopback | |||
) |
Definition at line 1058 of file IPAddressTest.cpp.
References addr, AddressFlags::address, EXPECT_EQ, AddressFlags::isLoopback(), and AddressFlags::version.
TEST_P | ( | IPAddressFlagTest | , |
IsPrivate | |||
) |
Definition at line 1066 of file IPAddressTest.cpp.
References addr, AddressFlags::address, EXPECT_EQ, AddressFlags::isPrivate(), and AddressFlags::version.
TEST_P | ( | IPAddressFlagTest | , |
IsNonroutable | |||
) |
Definition at line 1074 of file IPAddressTest.cpp.
References addr, AddressFlags::address, EXPECT_EQ, AddressFlags::isNonroutable(), and AddressFlags::version.
TEST_P | ( | IPAddressFlagTest | , |
IsZero | |||
) |
Definition at line 1082 of file IPAddressTest.cpp.
References addr, AddressFlags::address, EXPECT_EQ, AddressFlags::isZero(), and AddressFlags::version.
TEST_P | ( | IPAddressFlagTest | , |
IsLinkLocal | |||
) |
Definition at line 1090 of file IPAddressTest.cpp.
References addr, AddressFlags::address, EXPECT_EQ, and AddressFlags::isLinkLocal().
TEST_P | ( | IPAddressFlagTest | , |
IsLinkLocalBroadcast | |||
) |
Definition at line 1104 of file IPAddressTest.cpp.
References addr, AddressFlags::address, EXPECT_EQ, AddressFlags::isLinkLocalBroadcast(), and AddressFlags::version.
TEST_P | ( | IPAddressByteAccessorTest | , |
CheckBytes | |||
) |
Definition at line 1124 of file IPAddressTest.cpp.
TEST_P | ( | IPAddressBitAccessorTest | , |
CheckBits | |||
) |
Definition at line 1144 of file IPAddressTest.cpp.
References EXPECT_EQ, i, and folly::makeBitIterator().
|
static |
Definition at line 1393 of file IPAddressTest.cpp.
Definition at line 1361 of file IPAddressTest.cpp.
|
static |
Definition at line 1371 of file IPAddressTest.cpp.
Definition at line 842 of file IPAddressTest.cpp.
Definition at line 825 of file IPAddressTest.cpp.
|
static |
Definition at line 1386 of file IPAddressTest.cpp.
|
static |
Definition at line 1390 of file IPAddressTest.cpp.
|
static |
Definition at line 1382 of file IPAddressTest.cpp.
|
static |
Definition at line 1389 of file IPAddressTest.cpp.
|
static |
Definition at line 1383 of file IPAddressTest.cpp.
|
static |
Definition at line 1384 of file IPAddressTest.cpp.
|
static |
Definition at line 1388 of file IPAddressTest.cpp.
|
static |
Definition at line 1385 of file IPAddressTest.cpp.
|
static |
Definition at line 977 of file IPAddressTest.cpp.
Referenced by TEST().
Definition at line 1470 of file IPAddressTest.cpp.
|
static |
Definition at line 1523 of file IPAddressTest.cpp.
Definition at line 1479 of file IPAddressTest.cpp.
|
static |
Definition at line 983 of file IPAddressTest.cpp.
Definition at line 896 of file IPAddressTest.cpp.
|
static |
Definition at line 853 of file IPAddressTest.cpp.
|
static |
Definition at line 1350 of file IPAddressTest.cpp.