chromium/third_party/abseil-cpp/absl/types/span_test.cc

// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "absl/types/span.h"

#include <array>
#include <initializer_list>
#include <numeric>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <vector>

#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/attributes.h"
#include "absl/base/config.h"
#include "absl/base/internal/exception_testing.h"
#include "absl/base/options.h"
#include "absl/container/fixed_array.h"
#include "absl/container/inlined_vector.h"
#include "absl/hash/hash_testing.h"
#include "absl/meta/type_traits.h"
#include "absl/strings/str_cat.h"

namespace {

static_assert;

MATCHER_P(DataIs, data,
          absl::StrCat("data() ", negation ? "isn't " : "is ",
                       testing::PrintToString(data))) {}

template <typename T>
auto SpanIs(T data, size_t size)
    -> decltype(testing::AllOf(DataIs(data), testing::SizeIs(size))) {}

template <typename Container>
auto SpanIs(const Container& c) -> decltype(SpanIs(c.data(), c.size())) {}

std::vector<int> MakeRamp(int len, int offset = 0) {}

TEST(IntSpan, EmptyCtors) {}

TEST(IntSpan, PtrLenCtor) {}

TEST(IntSpan, ArrayCtor) {}

template <typename T>
void TakesGenericSpan(absl::Span<T>) {}

TEST(IntSpan, ContainerCtor) {}

// A struct supplying shallow data() const.
struct ContainerWithShallowConstData {};

TEST(IntSpan, ShallowConstness) {}

TEST(CharSpan, StringCtor) {}

TEST(IntSpan, FromConstPointer) {}

struct TypeWithMisleadingData {};

struct TypeWithMisleadingSize {};

TEST(IntSpan, EvilTypes) {}

struct Base {};
struct Derived : Base {};

TEST(IntSpan, SpanOfDerived) {}

void TestInitializerList(absl::Span<const int> s, const std::vector<int>& v) {}

TEST(ConstIntSpan, InitializerListConversion) {}

TEST(IntSpan, Data) {}

TEST(IntSpan, SizeLengthEmpty) {}

TEST(IntSpan, ElementAccess) {}

TEST(IntSpan, AtThrows) {}

TEST(IntSpan, RemovePrefixAndSuffix) {}

TEST(IntSpan, Subspan) {}

TEST(IntSpan, First) {}

TEST(IntSpan, Last) {}

TEST(IntSpan, MakeSpanPtrLength) {}

TEST(IntSpan, MakeSpanTwoPtrs) {}

TEST(IntSpan, MakeSpanContainer) {}

TEST(CharSpan, MakeSpanString) {}

TEST(IntSpan, MakeSpanArray) {}

// Compile-asserts that the argument has the expected decayed type.
template <typename Expected, typename T>
void CheckType(const T& /* value */) {}

TEST(IntSpan, MakeSpanTypes) {}

TEST(ConstIntSpan, MakeConstSpanTypes) {}

TEST(IntSpan, Equality) {}

class IntSpanOrderComparisonTest : public testing::Test {};

TEST_F(IntSpanOrderComparisonTest, CompareSpans) {}

TEST_F(IntSpanOrderComparisonTest, SpanOfConstAndContainer) {}

TEST_F(IntSpanOrderComparisonTest, SpanOfMutableAndContainer) {}

TEST_F(IntSpanOrderComparisonTest, EqualSpans) {}

TEST_F(IntSpanOrderComparisonTest, Subspans) {}

TEST_F(IntSpanOrderComparisonTest, EmptySpans) {}

TEST(IntSpan, ExposesContainerTypesAndConsts) {}

TEST(IntSpan, IteratorsAndReferences) {}

TEST(IntSpan, IteratorsAndReferences_Const) {}

TEST(IntSpan, NoexceptTest) {}

// ConstexprTester exercises expressions in a constexpr context. Simply placing
// the expression in a constexpr function is not enough, as some compilers will
// simply compile the constexpr function as runtime code. Using template
// parameters forces compile-time execution.
template <int i>
struct ConstexprTester {};

#define ABSL_TEST_CONSTEXPR(expr)

struct ContainerWithConstexprMethods {};

TEST(ConstIntSpan, ConstexprTest) {}

struct BigStruct {};

TEST(Span, SpanSize) {}

TEST(Span, Hash) {}

}  // namespace