diff options
Diffstat (limited to 'Firestore/core/test/firebase/firestore/util/hashing_test.cc')
-rw-r--r-- | Firestore/core/test/firebase/firestore/util/hashing_test.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Firestore/core/test/firebase/firestore/util/hashing_test.cc b/Firestore/core/test/firebase/firestore/util/hashing_test.cc index e5d9ff8..2c5c2f7 100644 --- a/Firestore/core/test/firebase/firestore/util/hashing_test.cc +++ b/Firestore/core/test/firebase/firestore/util/hashing_test.cc @@ -16,6 +16,9 @@ #include "Firestore/core/src/firebase/firestore/util/hashing.h" +#include <map> +#include <string> + #include "absl/strings/string_view.h" #include "gtest/gtest.h" @@ -29,6 +32,21 @@ struct HasHashMember { } }; +TEST(HashingTest, HasStdHash) { + EXPECT_TRUE(impl::has_std_hash<float>::value); + EXPECT_TRUE(impl::has_std_hash<double>::value); + EXPECT_TRUE(impl::has_std_hash<int>::value); + EXPECT_TRUE(impl::has_std_hash<int64_t>::value); + EXPECT_TRUE(impl::has_std_hash<std::string>::value); + EXPECT_TRUE(impl::has_std_hash<void*>::value); + EXPECT_TRUE(impl::has_std_hash<const char*>::value); + + struct Foo {}; + EXPECT_FALSE(impl::has_std_hash<Foo>::value); + EXPECT_FALSE(impl::has_std_hash<absl::string_view>::value); + EXPECT_FALSE((impl::has_std_hash<std::map<std::string, std::string>>::value)); +} + TEST(HashingTest, Int) { ASSERT_EQ(std::hash<int>{}(0), Hash(0)); } |