|
15 | 15 | #include "gmock/gmock.h"
|
16 | 16 | #include "gtest/gtest.h"
|
17 | 17 | #include <map>
|
| 18 | +#include <optional> |
18 | 19 | #include <set>
|
19 | 20 | #include <utility>
|
20 | 21 | #include <variant>
|
@@ -86,6 +87,14 @@ struct CtorTesterMapInfo {
|
86 | 87 | CtorTester getTestKey(int i, CtorTester *) { return CtorTester(i); }
|
87 | 88 | CtorTester getTestValue(int i, CtorTester *) { return CtorTester(42 + i); }
|
88 | 89 |
|
| 90 | +std::optional<uint32_t> getTestKey(int i, std::optional<uint32_t> *) { |
| 91 | + return i; |
| 92 | +} |
| 93 | + |
| 94 | +std::optional<uint32_t> getTestValue(int i, std::optional<uint32_t> *) { |
| 95 | + return 42 + i; |
| 96 | +} |
| 97 | + |
89 | 98 | // Test fixture, with helper functions implemented by forwarding to global
|
90 | 99 | // function overloads selected by component types of the type parameter. This
|
91 | 100 | // allows all of the map implementations to be tested with shared
|
@@ -117,11 +126,13 @@ typedef ::testing::Types<DenseMap<uint32_t, uint32_t>,
|
117 | 126 | DenseMap<uint32_t *, uint32_t *>,
|
118 | 127 | DenseMap<CtorTester, CtorTester, CtorTesterMapInfo>,
|
119 | 128 | DenseMap<EnumClass, uint32_t>,
|
| 129 | + DenseMap<std::optional<uint32_t>, uint32_t>, |
120 | 130 | SmallDenseMap<uint32_t, uint32_t>,
|
121 | 131 | SmallDenseMap<uint32_t *, uint32_t *>,
|
122 | 132 | SmallDenseMap<CtorTester, CtorTester, 4,
|
123 | 133 | CtorTesterMapInfo>,
|
124 |
| - SmallDenseMap<EnumClass, uint32_t> |
| 134 | + SmallDenseMap<EnumClass, uint32_t>, |
| 135 | + SmallDenseMap<std::optional<uint32_t>, uint32_t> |
125 | 136 | > DenseMapTestTypes;
|
126 | 137 | // clang-format on
|
127 | 138 |
|
|
0 commit comments