| 56 CX_TEST_ASSERT(cxstr_key.data == str); |
56 CX_TEST_ASSERT(cxstr_key.data == str); |
| 57 CX_TEST_ASSERT(obj_key.len == len); |
57 CX_TEST_ASSERT(obj_key.len == len); |
| 58 CX_TEST_ASSERT(obj_key.data == str); |
58 CX_TEST_ASSERT(obj_key.data == str); |
| 59 CX_TEST_ASSERT(bytes_key.len == len); |
59 CX_TEST_ASSERT(bytes_key.len == len); |
| 60 CX_TEST_ASSERT(bytes_key.data == str); |
60 CX_TEST_ASSERT(bytes_key.data == str); |
| |
61 } |
| |
62 } |
| |
63 |
| |
64 CX_TEST(test_hash_key_from_pointer_to_another_key) { |
| |
65 CxHashKey k = CX_HASH_KEY("one key"); |
| |
66 CX_TEST_DO { |
| |
67 const CxHashKey *p1 = &k; |
| |
68 CxHashKey *p2 = &k; |
| |
69 CxHashKey k1 = CX_HASH_KEY(p1); |
| |
70 CxHashKey k2 = CX_HASH_KEY(p2); |
| |
71 CX_TEST_ASSERT(0 == cx_hash_key_cmp(&k, &k1)); |
| |
72 CX_TEST_ASSERT(0 == cx_hash_key_cmp(&k, &k2)); |
| |
73 // check that this did not copy the data |
| |
74 CX_TEST_ASSERT(k.data == k1.data); |
| |
75 CX_TEST_ASSERT(k.data == k2.data); |
| 61 } |
76 } |
| 62 } |
77 } |
| 63 |
78 |
| 64 CX_TEST(test_hash_key_int_functions) { |
79 CX_TEST(test_hash_key_int_functions) { |
| 65 uint32_t a = 0xabc01337u; |
80 uint32_t a = 0xabc01337u; |
| 175 |
190 |
| 176 CxTestSuite *cx_test_suite_hash_key(void) { |
191 CxTestSuite *cx_test_suite_hash_key(void) { |
| 177 CxTestSuite *suite = cx_test_suite_new("hash_key"); |
192 CxTestSuite *suite = cx_test_suite_new("hash_key"); |
| 178 |
193 |
| 179 cx_test_register(suite, test_hash_key_functions); |
194 cx_test_register(suite, test_hash_key_functions); |
| |
195 cx_test_register(suite, test_hash_key_from_pointer_to_another_key); |
| 180 cx_test_register(suite, test_hash_key_int_functions); |
196 cx_test_register(suite, test_hash_key_int_functions); |
| 181 cx_test_register(suite, test_hash_key_macro); |
197 cx_test_register(suite, test_hash_key_macro); |
| 182 cx_test_register(suite, test_hash_key_cmp); |
198 cx_test_register(suite, test_hash_key_cmp); |
| 183 cx_test_register(suite, test_hash_key_empty_string); |
199 cx_test_register(suite, test_hash_key_empty_string); |
| 184 cx_test_register(suite, test_hash_key_null); |
200 cx_test_register(suite, test_hash_key_null); |