llvm/llvm/unittests/ADT/StringMapTest.cpp

//===- llvm/unittest/ADT/StringMapMap.cpp - StringMap unit tests ----------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/DataTypes.h"
#include "gtest/gtest.h"
#include <limits>
#include <tuple>
usingnamespacellvm;

namespace {

static_assert;

// Test fixture
class StringMapTest : public testing::Test {};

const char StringMapTest::testKey[] =;
const uint32_t StringMapTest::testValue =;
const char *StringMapTest::testKeyFirst =;
size_t StringMapTest::testKeyLength =;
const std::string StringMapTest::testKeyStr(testKey);

struct CountCopyAndMove {};

// Empty map tests.
TEST_F(StringMapTest, EmptyMapTest) {}

// Constant map tests.
TEST_F(StringMapTest, ConstEmptyMapTest) {}

// initializer_list ctor test; also implicitly tests initializer_list and
// iterator overloads of insert().
TEST_F(StringMapTest, InitializerListCtor) {}

// A map with a single entry.
TEST_F(StringMapTest, SingleEntryMapTest) {}

// Test clear() method.
TEST_F(StringMapTest, ClearTest) {}

// Test erase(iterator) method.
TEST_F(StringMapTest, EraseIteratorTest) {}

// Test erase(value) method.
TEST_F(StringMapTest, EraseValueTest) {}

// Test inserting two values and erasing one.
TEST_F(StringMapTest, InsertAndEraseTest) {}

TEST_F(StringMapTest, SmallFullMapTest) {}

TEST_F(StringMapTest, CopyCtorTest) {}

TEST_F(StringMapTest, AtTest) {}

// A more complex iteration test.
TEST_F(StringMapTest, IterationTest) {}

// Test StringMapEntry::Create() method.
TEST_F(StringMapTest, StringMapEntryTest) {}

// Test insert() method.
TEST_F(StringMapTest, InsertTest) {}

// Test insert(pair<K, V>) method
TEST_F(StringMapTest, InsertPairTest) {}

// Test insert(pair<K, V>) method when rehashing occurs
TEST_F(StringMapTest, InsertRehashingPairTest) {}

TEST_F(StringMapTest, InsertOrAssignTest) {}

TEST_F(StringMapTest, IterMapKeysVector) {}

TEST_F(StringMapTest, IterMapKeysSmallVector) {}

// Create a non-default constructable value
struct StringMapTestStruct {};

TEST_F(StringMapTest, NonDefaultConstructable) {}

struct Immovable {};

struct MoveOnly {};

TEST_F(StringMapTest, MoveOnly) {}

TEST_F(StringMapTest, CtorArg) {}

TEST_F(StringMapTest, MoveConstruct) {}

TEST_F(StringMapTest, MoveAssignment) {}

TEST_F(StringMapTest, EqualEmpty) {}

TEST_F(StringMapTest, EqualWithValues) {}

TEST_F(StringMapTest, NotEqualMissingKeys) {}

TEST_F(StringMapTest, NotEqualWithDifferentValues) {}

TEST_F(StringMapTest, PrecomputedHash) {}

struct Countable {};

TEST_F(StringMapTest, MoveDtor) {}

TEST_F(StringMapTest, StructuredBindings) {}

namespace {
// Simple class that counts how many moves and copy happens when growing a map
struct CountCtorCopyAndMove {};
unsigned CountCtorCopyAndMove::Copy =;
unsigned CountCtorCopyAndMove::Move =;
unsigned CountCtorCopyAndMove::Ctor =;

} // anonymous namespace

// Make sure creating the map with an initial size of N actually gives us enough
// buckets to insert N items without increasing allocation size.
TEST(StringMapCustomTest, InitialSizeTest) {}

TEST(StringMapCustomTest, BracketOperatorCtor) {}

namespace {
struct NonMoveableNonCopyableType {};
} // namespace

// Test that we can "emplace" an element in the map without involving map/move
TEST(StringMapCustomTest, EmplaceTest) {}

// Test that StringMapEntryBase can handle size_t wide sizes.
TEST(StringMapCustomTest, StringMapEntryBaseSize) {}

// Test that StringMapEntry can handle size_t wide sizes.
TEST(StringMapCustomTest, StringMapEntrySize) {}

} // end anonymous namespace