hash: Add function for efficiently combining hashes
You can now call stdplus::hashMulti(...) with multiple arguments and get
a single resulting hash value.
Change-Id: I82d91f3372daeea941f6b9e8d57a224b5806527d
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/hash.cpp b/test/hash.cpp
new file mode 100644
index 0000000..23e0e26
--- /dev/null
+++ b/test/hash.cpp
@@ -0,0 +1,17 @@
+#include <stdplus/hash.hpp>
+
+#include <string>
+
+#include <gtest/gtest.h>
+
+namespace stdplus
+{
+
+TEST(HashMulti, Basic)
+{
+ EXPECT_EQ(0, hashMulti());
+ EXPECT_EQ(2654435834, hashMulti(1, 2));
+ hashMulti(1, std::string("bacon"), nullptr);
+}
+
+} // namespace stdplus
diff --git a/test/meson.build b/test/meson.build
index 901527d..98435bf 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -3,6 +3,7 @@
'exception': [stdplus_dep, gtest_main_dep],
'handle/copyable': [stdplus_dep, gtest_main_dep],
'handle/managed': [stdplus_dep, gtest_main_dep],
+ 'hash': [stdplus_dep, gtest_main_dep],
'pinned': [stdplus_dep, gtest_main_dep],
'raw': [stdplus_dep, gmock_dep, gtest_main_dep],
'signal': [stdplus_dep, gtest_main_dep],