diff options
Diffstat (limited to 'llvm/unittests/ADT/StringMapTest.cpp')
-rw-r--r-- | llvm/unittests/ADT/StringMapTest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/StringMapTest.cpp b/llvm/unittests/ADT/StringMapTest.cpp index f9b138e..c9ef3f8a 100644 --- a/llvm/unittests/ADT/StringMapTest.cpp +++ b/llvm/unittests/ADT/StringMapTest.cpp @@ -487,6 +487,17 @@ TEST_F(StringMapTest, NotEqualWithDifferentValues) { ASSERT_TRUE(B != A); } +TEST_F(StringMapTest, PrecomputedHash) { + StringMap<int> A; + StringRef Key = "foo"; + int Value = 42; + uint64_t Hash = StringMap<int>::hash(Key); + A.insert({"foo", Value}, Hash); + auto I = A.find(Key, Hash); + ASSERT_NE(I, A.end()); + ASSERT_EQ(I->second, Value); +} + struct Countable { int &InstanceCount; int Number; |