chromium/third_party/dawn/src/tint/utils/containers/vector_test.cc

// Copyright 2022 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
//    list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
//    contributors may be used to endorse or promote products derived from
//    this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "src/tint/utils/containers/vector.h"

#include <string>
#include <tuple>

#include "gmock/gmock.h"

#include "src/tint/utils/containers/predicates.h"
#include "src/tint/utils/macros/compiler.h"
#include "src/tint/utils/memory/bitcast.h"
#include "src/tint/utils/text/string_stream.h"

// MSVC claims there's unreachable code in some of the EXPECT_DEATH cases, but scoping the
// DISABLE_WARNING to the test is not sufficient to suppress the warning.
TINT_BEGIN_DISABLE_WARNING();

namespace tint {
namespace {

class C0 : public Castable<C0> {};
class C1 : public Castable<C1, C0> {};
class C2a : public Castable<C2a, C1> {};
class C2b : public Castable<C2b, C1> {};

/// @returns true if the address of el is within the memory of the vector vec.
template <typename T, size_t N, typename E>
bool IsInternal(Vector<T, N>& vec, E& el) {}

/// @returns true if all elements of the vector `vec` are held within the memory of `vec`.
template <typename T, size_t N>
bool AllInternallyHeld(Vector<T, N>& vec) {}

/// @returns true if all elements of the vector `vec` are held outside the memory of `vec`.
template <typename T, size_t N>
bool AllExternallyHeld(Vector<T, N>& vec) {}

////////////////////////////////////////////////////////////////////////////////
// Static asserts
////////////////////////////////////////////////////////////////////////////////
static_assert;
static_assert;
static_assert;

static_assert;
static_assert;

static_assert;
static_assert;
static_assert;
static_assert;

static_assert;
static_assert;
static_assert;
static_assert;

static_assert;
static_assert;
static_assert;

////////////////////////////////////////////////////////////////////////////////
// TintVectorTest
////////////////////////////////////////////////////////////////////////////////
TEST(TintVectorTest, SmallArray_Empty) {}

TEST(TintVectorTest, NoSmallArray) {}

TEST(TintVectorTest, Empty_SmallArray_Empty) {}

TEST(TintVectorTest, Empty_NoSmallArray) {}

TEST(TintVectorTest, InitializerList_NoSpill) {}

TEST(TintVectorTest, InitializerList_WithSpill) {}

TEST(TintVectorTest, InitializerList_NoSmallArray) {}

TEST(TintVectorTest, Push_NoSmallArray) {}

TEST(TintVectorTest, Insert) {}

TEST(TintVectorTest, Erase_Front) {}

TEST(TintVectorTest, Erase_Mid) {}

TEST(TintVectorTest, Erase_Back) {}

TEST(TintVectorTest, EraseIf_Front) {}

TEST(TintVectorTest, EraseIf_Mid) {}

TEST(TintVectorTest, EraseIf_Back) {}

TEST(TintVectorTest, InferTN_1CString) {}

TEST(TintVectorTest, InferTN_2CStrings) {}

TEST(TintVectorTest, InferTN_IntFloat) {}

TEST(TintVectorTest, InferTN_IntDoubleIntDouble) {}

TEST(TintVectorTest, InferTN_C0) {}

TEST(TintVectorTest, InferTN_ConstC0) {}

TEST(TintVectorTest, InferTN_C0C1) {}

TEST(TintVectorTest, InferTN_ConstC0C1) {}

TEST(TintVectorTest, InferTN_C0ConstC1) {}

TEST(TintVectorTest, InferTN_ConstC0ConstC1) {}

TEST(TintVectorTest, InferTN_C2aC2b) {}

TEST(TintVectorTest, InferTN_ConstC2aC2b) {}

TEST(TintVectorTest, InferTN_C2aConstC2b) {}

TEST(TintVectorTest, InferTN_ConstC2aConstC2b) {}

TEST(TintVectorTest, CopyVector_NoSpill_N2_to_N2) {}

TEST(TintVectorTest, CopyVector_WithSpill_N2_to_N2) {}

TEST(TintVectorTest, CopyVector_NoSpill_N2_to_N1) {}

TEST(TintVectorTest, CopyVector_WithSpill_N2_to_N1) {}

TEST(TintVectorTest, CopyVector_NoSpill_N2_to_N3) {}

TEST(TintVectorTest, CopyVector_WithSpill_N2_to_N3) {}

TEST(TintVectorTest, CopyVector_NoMoveUpcast_NoSpill) {}

TEST(TintVectorTest, CopyVector_NoMoveUpcast_WithSpill) {}

TEST(TintVectorTest, CopyVector_NoMoveAddConst_NoSpill) {}

TEST(TintVectorTest, CopyVector_NoMoveAddConst_WithSpill) {}

TEST(TintVectorTest, CopyVector_NoMoveUpcastAndAddConst_NoSpill) {}

TEST(TintVectorTest, CopyVector_NoMoveUpcastAndAddConst_WithSpill) {}

TEST(TintVectorTest, MoveVector_NoSpill_N2_to_N2) {}

TEST(TintVectorTest, MoveVector_WithSpill_N2_to_N2) {}

TEST(TintVectorTest, MoveVector_NoSpill_N2_to_N1) {}

TEST(TintVectorTest, MoveVector_WithSpill_N2_to_N1) {}

TEST(TintVectorTest, MoveVector_NoSpill_N2_to_N3) {}

TEST(TintVectorTest, MoveVector_WithSpill_N2_to_N3) {}

TEST(TintVectorTest, MoveVector_Upcast_NoSpill) {}

TEST(TintVectorTest, MoveVector_Upcast_WithSpill) {}

TEST(TintVectorTest, MoveVector_AddConst_NoSpill) {}

TEST(TintVectorTest, MoveVector_AddConst_WithSpill) {}

TEST(TintVectorTest, MoveVector_UpcastAndAddConst_NoSpill) {}

TEST(TintVectorTest, MoveVector_UpcastAndAddConst_WithSpill) {}

TEST(TintVectorTest, CopyAssign_NoSpill_N2_to_N2) {}

TEST(TintVectorTest, CopyAssign_WithSpill_N2_to_N2) {}

TEST(TintVectorTest, CopyAssign_NoSpill_N2_to_N1) {}

TEST(TintVectorTest, CopyAssign_WithSpill_N2_to_N1) {}

TEST(TintVectorTest, CopyAssign_NoSpill_N2_to_N3) {}

TEST(TintVectorTest, CopyAssign_WithSpill_N2_to_N3) {}

TEST(TintVectorTest, CopyAssign_NoSpill_N2_to_N0) {}

TEST(TintVectorTest, CopyAssign_WithSpill_N2_to_N0) {}

TEST(TintVectorTest, CopyAssign_Self_NoSpill) {}

TEST(TintVectorTest, CopyAssign_Self_WithSpill) {}

TEST(TintVectorTest, MoveAssign_NoSpill_N2_to_N2) {}

TEST(TintVectorTest, MoveAssign_WithSpill_N2_to_N2) {}

TEST(TintVectorTest, MoveAssign_NoSpill_N2_to_N1) {}

TEST(TintVectorTest, MoveAssign_SpillSpill_N2_to_N1) {}

TEST(TintVectorTest, MoveAssign_NoSpill_N2_to_N3) {}

TEST(TintVectorTest, MoveAssign_WithSpill_N2_to_N3) {}

TEST(TintVectorTest, MoveAssign_NoSpill_N2_to_N0) {}

TEST(TintVectorTest, MoveAssign_WithSpill_N2_to_N0) {}

TEST(TintVectorTest, MoveAssign_Self_NoSpill) {}

TEST(TintVectorTest, MoveAssign_Self_WithSpill) {}

TEST(TintVectorTest, RepeatMoveAssign_NoSpill) {}

TEST(TintVectorTest, RepeatMoveAssign_WithSpill) {}

TEST(TintVectorTest, CopyAssignRef_NoSpill_N2_to_N2) {}

TEST(TintVectorTest, CopyAssignRef_WithSpill_N2_to_N2) {}

TEST(TintVectorTest, CopyAssignRef_NoSpill_N2_to_N1) {}

TEST(TintVectorTest, CopyAssignRef_WithSpill_N2_to_N1) {}

TEST(TintVectorTest, CopyAssignRef_NoSpill_N2_to_N3) {}

TEST(TintVectorTest, CopyAssignRef_WithSpill_N2_to_N3) {}

TEST(TintVectorTest, CopyAssignRef_NoSpill_N2_to_N0) {}

TEST(TintVectorTest, CopyAssignRef_WithSpill_N2_to_N0) {}

TEST(TintVectorTest, CopyAssignRef_Self_NoSpill) {}

TEST(TintVectorTest, CopyAssignRef_Self_WithSpill) {}

TEST(TintVectorTest, MoveAssignRef_NoSpill_N2_to_N2) {}

TEST(TintVectorTest, MoveAssignRef_WithSpill_N2_to_N2) {}

TEST(TintVectorTest, MoveAssignRef_NoSpill_N2_to_N1) {}

TEST(TintVectorTest, MoveAssignRef_SpillSpill_N2_to_N1) {}

TEST(TintVectorTest, MoveAssignRef_NoSpill_N2_to_N3) {}

TEST(TintVectorTest, MoveAssignRef_WithSpill_N2_to_N3) {}

TEST(TintVectorTest, MoveAssignRef_NoSpill_N2_to_N0) {}

TEST(TintVectorTest, MoveAssignRef_WithSpill_N2_to_N0) {}

TEST(TintVectorTest, MoveAssignRef_Self_NoSpill) {}

TEST(TintVectorTest, MoveAssignRef_Self_WithSpill) {}

TEST(TintVectorTest, RepeatMoveAssignRef_NoSpill) {}

TEST(TintVectorTest, RepeatMoveAssignRef_WithSpill) {}

TEST(TintVectorTest, CopyAssignSlice_N2_to_N2) {}

TEST(TintVectorTest, CopyAssignSlice_N2_to_N1) {}

TEST(TintVectorTest, CopyAssignSlice_N2_to_N3) {}

TEST(TintVectorTest, CopyAssignSlice_N2_to_N0) {}

TEST(TintVectorTest, Index) {}

TEST(TintVectorTest, ConstIndex) {}

TEST(TintVectorTest, Reserve_NoSpill) {}

TEST(TintVectorTest, Reserve_WithSpill) {}

TEST(TintVectorTest, ResizeZero_NoSpill) {}

TEST(TintVectorTest, ResizeZero_WithSpill) {}

TEST(TintVectorTest, ResizeValue_NoSpill) {}

TEST(TintVectorTest, ResizeValue_WithSpill) {}

TEST(TintVectorTest, Reserve_NoSmallArray) {}

TEST(TintVectorTest, Resize_NoSmallArray) {}

TEST(TintVectorTest, Copy_NoSpill_N2_to_N2_Empty) {}

TEST(TintVectorTest, Copy_NoSpill_N2_to_N2_NonEmpty) {}

TEST(TintVectorTest, Copy_NoSpill_N2_to_N2_Spill) {}

TEST(TintVectorTest, Copy_WithSpill_N2_to_N2_Empty) {}

TEST(TintVectorTest, Copy_WithSpill_N2_to_N2_NonEmpty) {}

TEST(TintVectorTest, Copy_WithSpill_N2_to_N2_Spill) {}

TEST(TintVectorTest, Copy_NoSpill_N2_to_N1_Empty) {}

TEST(TintVectorTest, Copy_NoSpill_N2_to_N1_NonEmpty) {}

TEST(TintVectorTest, Copy_NoSpill_N2_to_N1_Spill) {}

TEST(TintVectorTest, Copy_WithSpill_N2_to_N1_Empty) {}

TEST(TintVectorTest, Copy_WithSpill_N2_to_N1_NonEmpty) {}

TEST(TintVectorTest, Copy_WithSpill_N2_to_N1_Spill) {}

TEST(TintVectorTest, Copy_NoSpill_N2_to_N3_Empty) {}

TEST(TintVectorTest, Copy_NoSpill_N2_to_N3_NonEmpty) {}

TEST(TintVectorTest, Copy_NoSpill_N2_to_N3_Spill) {}

TEST(TintVectorTest, Copy_WithSpill_N2_to_N3_Empty) {}

TEST(TintVectorTest, Copy_WithSpill_N2_to_N3_NonEmpty) {}

TEST(TintVectorTest, Copy_WithSpill_N2_to_N3_Spill) {}

TEST(TintVectorTest, Clear_Empty) {}

TEST(TintVectorTest, Clear_NoSpill) {}

TEST(TintVectorTest, Clear_WithSpill) {}

TEST(TintVectorTest, PushPop_StringNoSpill) {}

TEST(TintVectorTest, PushPop_StringWithSpill) {}

TEST(TintVectorTest, PushPop_StringMoveNoSpill) {}

TEST(TintVectorTest, PushPop_StringMoveWithSpill) {}

TEST(TintVectorTest, EmplacePop_TupleVarArgNoSpill) {}

TEST(TintVectorTest, EmplacePop_TupleVarArgWithSpill) {}

TEST(TintVectorTest, IsEmpty) {}

TEST(TintVectorTest, FrontBack_NoSpill) {}

TEST(TintVectorTest, FrontBack_WithSpill) {}

TEST(TintVectorTest, ConstFrontBack_NoSpill) {}

TEST(TintVectorTest, ConstFrontBack_WithSpill) {}

TEST(TintVectorTest, BeginEnd_NoSpill) {}

TEST(TintVectorTest, RbeginRend_NoSpill) {}

TEST(TintVectorTest, BeginEnd_WithSpill) {}

TEST(TintVectorTest, RbeginRend_WithSpill) {}

TEST(TintVectorTest, ConstBeginEnd_NoSpill) {}

TEST(TintVectorTest, ConstRbeginRend_NoSpill) {}

TEST(TintVectorTest, ConstBeginEnd_WithSpill) {}

TEST(TintVectorTest, ConstRbeginRend_WithSpill) {}

TEST(TintVectorTest, Equality) {}

TEST(TintVectorTest, Sort) {}

TEST(TintVectorTest, ReverseOdd) {}

TEST(TintVectorTest, ReverseEven) {}

TEST(TintVectorTest, Any) {}

TEST(TintVectorTest, All) {}

TEST(TintVectorTest, Slice) {}

TEST(TintVectorTest, SliceConst) {}

TEST(TintVectorTest, ostream) {}

TEST(TintVectorDeathTest, AssertOOBs) {}

#if TINT_VECTOR_MUTATION_CHECKS_ENABLED
TEST(TintVectorDeathTest, AssertPushWhileIterating) {}

TEST(TintVectorDeathTest, AssertPopWhileIterating) {}

TEST(TintVectorDeathTest, AssertClearWhileIterating) {}
#endif

////////////////////////////////////////////////////////////////////////////////
// TintVectorRefTest
////////////////////////////////////////////////////////////////////////////////
TEST(TintVectorRefTest, CopyVectorRef) {}

TEST(TintVectorRefTest, CopyVectorRef_Upcast) {}

TEST(TintVectorRefTest, CopyVectorRef_AddConst) {}

TEST(TintVectorRefTest, CopyVectorRef_UpcastAndAddConst) {}

TEST(TintVectorRefTest, MoveVectorRef) {}

TEST(TintVectorRefTest, MoveVectorRef_Upcast) {}

TEST(TintVectorRefTest, MoveVectorRef_AddConst) {}

TEST(TintVectorRefTest, MoveVectorRef_UpcastAndAddConst) {}

TEST(TintVectorRefTest, CopyVector) {}

TEST(TintVectorRefTest, CopyVector_Upcast) {}

TEST(TintVectorRefTest, CopyVector_AddConst) {}

TEST(TintVectorRefTest, CopyVector_UpcastAndAddConst) {}

TEST(TintVectorRefTest, MoveVector) {}

TEST(TintVectorRefTest, MoveVector_Upcast) {}

TEST(TintVectorRefTest, MoveVector_AddConst) {}

TEST(TintVectorRefTest, MoveVector_UpcastAndAddConst) {}

TEST(TintVectorRefTest, MoveVector_ReinterpretCast) {}

TEST(TintVectorRefTest, Index) {}

TEST(TintVectorRefTest, SortPredicate) {}

TEST(TintVectorRefTest, ConstIndex) {}

TEST(TintVectorRefTest, Length) {}

TEST(TintVectorRefTest, Capacity) {}

TEST(TintVectorRefTest, IsEmpty) {}

TEST(TintVectorRefTest, FrontBack) {}

TEST(TintVectorRefTest, BeginEnd) {}

TEST(TintVectorRefTest, RbeginRend) {}

TEST(TintVectorRefTest, ostream) {}

TEST(TintVectorRefDeathTest, AssertOOBs) {}

}  // namespace
}  // namespace tint

TINT_INSTANTIATE_TYPEINFO();
TINT_INSTANTIATE_TYPEINFO();
TINT_INSTANTIATE_TYPEINFO();
TINT_INSTANTIATE_TYPEINFO();

TINT_END_DISABLE_WARNING();