chromium/net/base/ip_address_unittest.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "net/base/ip_address.h"

#include <optional>
#include <vector>

#include "base/format_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

Optional;

namespace net {

namespace {

// Helper to stringize an IP address (used to define expectations).
std::string DumpIPAddress(const IPAddress& v) {}

TEST(IPAddressBytesTest, ConstructEmpty) {}

TEST(IPAddressBytesTest, ConstructIPv4) {}

TEST(IPAddressBytesTest, ConstructIPv6) {}

TEST(IPAddressBytesTest, Assign) {}

TEST(IPAddressTest, ConstructIPv4) {}

TEST(IPAddressTest, IsIPVersion) {}

TEST(IPAddressTest, IsValid) {}

enum IPAddressReservedResult : bool {};

// Tests for the reserved IPv4 ranges and the (unreserved) blocks in between.
// The reserved ranges are tested by checking the first and last address of each
// range. The unreserved blocks are tested similarly. These tests cover the
// entire IPv4 address range, as well as this range mapped to IPv6.
TEST(IPAddressTest, IsPubliclyRoutableIPv4) {}

// Tests for the reserved IPv6 ranges and the (unreserved) blocks in between.
// The reserved ranges are tested by checking the first and last address of each
// range. The unreserved blocks are tested similarly. These tests cover the
// entire IPv6 address range.
TEST(IPAddressTest, IsPubliclyRoutableIPv6) {}

TEST(IPAddressTest, IsZero) {}

TEST(IPAddressTest, IsIPv4Mapped) {}

TEST(IPAddressTest, AllZeros) {}

TEST(IPAddressTest, ToString) {}

TEST(IPAddressTest, IPAddressToStringWithPort) {}

TEST(IPAddressTest, IPAddressToPackedString) {}

// Test that invalid IP literals fail to parse.
TEST(IPAddressTest, AssignFromIPLiteral_FailParse) {}

// Test that a failure calling AssignFromIPLiteral() has the sideffect of
// clearing the current value.
TEST(IPAddressTest, AssignFromIPLiteral_ResetOnFailure) {}

// Test parsing an IPv4 literal.
TEST(IPAddressTest, AssignFromIPLiteral_IPv4) {}

// Test parsing an IPv6 literal.
TEST(IPAddressTest, AssignFromIPLiteral_IPv6) {}

TEST(IPAddressTest, IsIPv4MappedIPv6) {}

TEST(IPAddressTest, IsEqual) {}

TEST(IPAddressTest, LessThan) {}

// Test mapping an IPv4 address to an IPv6 address.
TEST(IPAddressTest, ConvertIPv4ToIPv4MappedIPv6) {}

// Test reversal of a IPv6 address mapping.
TEST(IPAddressTest, ConvertIPv4MappedIPv6ToIPv4) {}

TEST(IPAddressTest, IPAddressMatchesPrefix) {}

// Test parsing invalid CIDR notation literals.
TEST(IPAddressTest, ParseCIDRBlock_Invalid) {}

// Test parsing a valid CIDR notation literal.
TEST(IPAddressTest, ParseCIDRBlock_Valid) {}

TEST(IPAddressTest, ParseURLHostnameToAddress_FailParse) {}

TEST(IPAddressTest, ParseURLHostnameToAddress_IPv4) {}

TEST(IPAddressTest, ParseURLHostnameToAddress_IPv6) {}

TEST(IPAddressTest, IPAddressStartsWith) {}

TEST(IPAddressTest, IsLinkLocal) {}

TEST(IPAddressTest, IsUniqueLocalIPv6) {}

// Tests extraction of the NAT64 translation prefix.
TEST(IPAddressTest, ExtractPref64FromIpv4onlyArpaAAAA) {}

// Tests mapping an IPv4 address to an IPv6 address.
TEST(IPAddressTest, ConvertIPv4ToIPv4EmbeddedIPv6) {}

TEST(IPAddressTest, RoundtripAddressThroughValue) {}

TEST(IPAddressTest, FromGarbageValue) {}

TEST(IPAddressTest, FromInvalidValue) {}

TEST(IPAddressTest, IPv4Mask) {}

TEST(IPAddressTest, IPv6Mask) {}

}  // anonymous namespace

}  // namespace net