tests/test_hash_key.cpp

changeset 663
d50b5dc1e058
parent 653
e081643aae2a
child 690
2c2304622981
     1.1 --- a/tests/test_hash_key.cpp	Thu Feb 23 22:43:13 2023 +0100
     1.2 +++ b/tests/test_hash_key.cpp	Sun Mar 05 10:55:32 2023 +0100
     1.3 @@ -27,6 +27,7 @@
     1.4   */
     1.5  
     1.6  #include "cx/hash_key.h"
     1.7 +#include "cx/string.h"
     1.8  
     1.9  #include <gtest/gtest.h>
    1.10  
    1.11 @@ -39,15 +40,19 @@
    1.12              reinterpret_cast<unsigned char const *>(str), len);
    1.13      auto obj_key = cx_hash_key(
    1.14              reinterpret_cast<void const *>(str), len);
    1.15 +    auto cxstr_key = cx_hash_key_cxstr(cx_str(str));
    1.16  
    1.17      EXPECT_EQ(str_key.hash, bytes_key.hash);
    1.18      EXPECT_EQ(obj_key.hash, bytes_key.hash);
    1.19 +    EXPECT_EQ(cxstr_key.hash, bytes_key.hash);
    1.20      EXPECT_EQ(str_key.len, len);
    1.21 +    EXPECT_EQ(cxstr_key.len, len);
    1.22      EXPECT_EQ(bytes_key.len, len);
    1.23      EXPECT_EQ(bytes_key.len, len);
    1.24      EXPECT_EQ(str_key.data.cstr, str);
    1.25      EXPECT_EQ(bytes_key.data.cbytes, reinterpret_cast<unsigned char const *>(str));
    1.26      EXPECT_EQ(bytes_key.data.cobj, reinterpret_cast<void const *>(str));
    1.27 +    EXPECT_EQ(cxstr_key.data.cobj, reinterpret_cast<void const *>(str));
    1.28  }
    1.29  
    1.30  TEST(cx_hash_key, empty_string) {

mercurial