diff options
Diffstat (limited to 'llvm/unittests/ADT/DenseMapTest.cpp')
-rw-r--r-- | llvm/unittests/ADT/DenseMapTest.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/unittests/ADT/DenseMapTest.cpp b/llvm/unittests/ADT/DenseMapTest.cpp index c95f96c..e3e8e8c 100644 --- a/llvm/unittests/ADT/DenseMapTest.cpp +++ b/llvm/unittests/ADT/DenseMapTest.cpp @@ -15,6 +15,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" #include <map> +#include <optional> #include <set> #include <utility> #include <variant> @@ -86,6 +87,14 @@ struct CtorTesterMapInfo { CtorTester getTestKey(int i, CtorTester *) { return CtorTester(i); } CtorTester getTestValue(int i, CtorTester *) { return CtorTester(42 + i); } +std::optional<uint32_t> getTestKey(int i, std::optional<uint32_t> *) { + return i; +} + +std::optional<uint32_t> getTestValue(int i, std::optional<uint32_t> *) { + return 42 + i; +} + // Test fixture, with helper functions implemented by forwarding to global // function overloads selected by component types of the type parameter. This // allows all of the map implementations to be tested with shared @@ -117,11 +126,13 @@ typedef ::testing::Types<DenseMap<uint32_t, uint32_t>, DenseMap<uint32_t *, uint32_t *>, DenseMap<CtorTester, CtorTester, CtorTesterMapInfo>, DenseMap<EnumClass, uint32_t>, + DenseMap<std::optional<uint32_t>, uint32_t>, SmallDenseMap<uint32_t, uint32_t>, SmallDenseMap<uint32_t *, uint32_t *>, SmallDenseMap<CtorTester, CtorTester, 4, CtorTesterMapInfo>, - SmallDenseMap<EnumClass, uint32_t> + SmallDenseMap<EnumClass, uint32_t>, + SmallDenseMap<std::optional<uint32_t>, uint32_t> > DenseMapTestTypes; // clang-format on |