tests/test_hash_key.cpp

changeset 663
d50b5dc1e058
parent 653
e081643aae2a
child 690
2c2304622981
--- a/tests/test_hash_key.cpp	Thu Feb 23 22:43:13 2023 +0100
+++ b/tests/test_hash_key.cpp	Sun Mar 05 10:55:32 2023 +0100
@@ -27,6 +27,7 @@
  */
 
 #include "cx/hash_key.h"
+#include "cx/string.h"
 
 #include <gtest/gtest.h>
 
@@ -39,15 +40,19 @@
             reinterpret_cast<unsigned char const *>(str), len);
     auto obj_key = cx_hash_key(
             reinterpret_cast<void const *>(str), len);
+    auto cxstr_key = cx_hash_key_cxstr(cx_str(str));
 
     EXPECT_EQ(str_key.hash, bytes_key.hash);
     EXPECT_EQ(obj_key.hash, bytes_key.hash);
+    EXPECT_EQ(cxstr_key.hash, bytes_key.hash);
     EXPECT_EQ(str_key.len, len);
+    EXPECT_EQ(cxstr_key.len, len);
     EXPECT_EQ(bytes_key.len, len);
     EXPECT_EQ(bytes_key.len, len);
     EXPECT_EQ(str_key.data.cstr, str);
     EXPECT_EQ(bytes_key.data.cbytes, reinterpret_cast<unsigned char const *>(str));
     EXPECT_EQ(bytes_key.data.cobj, reinterpret_cast<void const *>(str));
+    EXPECT_EQ(cxstr_key.data.cobj, reinterpret_cast<void const *>(str));
 }
 
 TEST(cx_hash_key, empty_string) {

mercurial