universe@556: /* universe@556: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. universe@556: * universe@556: * Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved. universe@556: * universe@556: * Redistribution and use in source and binary forms, with or without universe@556: * modification, are permitted provided that the following conditions are met: universe@556: * universe@556: * 1. Redistributions of source code must retain the above copyright universe@556: * notice, this list of conditions and the following disclaimer. universe@556: * universe@556: * 2. Redistributions in binary form must reproduce the above copyright universe@556: * notice, this list of conditions and the following disclaimer in the universe@556: * documentation and/or other materials provided with the distribution. universe@556: * universe@556: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" universe@556: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE universe@556: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE universe@556: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE universe@556: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR universe@556: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF universe@556: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS universe@556: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN universe@556: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) universe@556: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE universe@556: * POSSIBILITY OF SUCH DAMAGE. universe@556: */ universe@556: universe@556: #include "cx/hash_map.h" universe@556: #include "cx/utils.h" universe@658: #include "cx/string.h" universe@556: #include "util_allocator.h" universe@691: #include "test_map_generics.h" universe@556: universe@556: #include universe@556: #include universe@556: #include universe@556: universe@556: struct map_operation { universe@556: enum { universe@556: put, rm universe@556: } op; universe@556: char const *key; universe@556: char const *value; universe@556: }; universe@556: universe@556: auto generate_map_operations() -> std::vector { universe@556: return { universe@556: {map_operation::put, "key 1", "test"}, universe@556: {map_operation::put, "key 2", "blub"}, universe@556: {map_operation::put, "key 3", "hallo"}, universe@556: {map_operation::put, "key 2", "foobar"}, universe@556: {map_operation::put, "key 4", "value 4"}, universe@556: {map_operation::put, "key 5", "value 5"}, universe@556: {map_operation::put, "key 6", "value 6"}, universe@556: {map_operation::rm, "key 4", nullptr}, universe@556: {map_operation::put, "key 7", "value 7"}, universe@556: {map_operation::put, "key 8", "value 8"}, universe@556: {map_operation::rm, "does not exist", nullptr}, universe@556: {map_operation::put, "key 9", "value 9"}, universe@556: {map_operation::put, "key 6", "other value"}, universe@556: {map_operation::put, "key 7", "something else"}, universe@556: {map_operation::rm, "key 8", nullptr}, universe@556: {map_operation::rm, "key 2", nullptr}, universe@556: {map_operation::put, "key 8", "new value"}, universe@556: }; universe@556: } universe@556: universe@556: static void verify_map_contents( universe@556: CxMap *map, universe@556: std::unordered_map const &refmap universe@556: ) { universe@556: // verify key iterator universe@556: { universe@556: auto keyiter = cxMapIteratorKeys(map); universe@556: std::unordered_set keys; universe@563: cx_foreach(CxHashKey*, elem, keyiter) { universe@691: keys.insert(std::string(reinterpret_cast(elem->data), elem->len)); universe@556: } universe@561: EXPECT_EQ(keyiter.index, map->size); universe@556: ASSERT_EQ(keys.size(), map->size); universe@556: for (auto &&k: keys) { universe@556: EXPECT_NE(refmap.find(k), refmap.end()); universe@556: } universe@556: } universe@556: universe@556: // verify value iterator universe@556: { universe@556: auto valiter = cxMapIteratorValues(map); universe@556: std::unordered_set values; // we use that the values in our test data are unique strings universe@556: cx_foreach(char const*, elem, valiter) { universe@556: values.insert(std::string(elem)); universe@556: } universe@561: EXPECT_EQ(valiter.index, map->size); universe@556: ASSERT_EQ(values.size(), map->size); universe@556: for (auto &&v: values) { universe@556: EXPECT_NE(std::find_if(refmap.begin(), refmap.end(), universe@556: [v](auto const &e) { return e.second == v; }), refmap.end()); universe@556: } universe@556: } universe@556: universe@556: // verify pair iterator universe@556: { universe@556: auto pairiter = cxMapIterator(map); universe@556: std::unordered_map pairs; universe@556: cx_foreach(CxMapEntry*, entry, pairiter) { universe@691: pairs[std::string(reinterpret_cast(entry->key->data), entry->key->len)] = std::string( universe@691: (char *) entry->value); universe@556: } universe@561: EXPECT_EQ(pairiter.index, map->size); universe@556: ASSERT_EQ(pairs.size(), refmap.size()); universe@556: for (auto &&p: pairs) { universe@556: ASSERT_EQ(p.second, refmap.at(p.first)); universe@556: } universe@556: } universe@556: } universe@556: universe@556: TEST(CxHashMap, Create) { universe@556: CxTestingAllocator allocator; universe@658: auto map = cxHashMapCreate(&allocator, 1, 0); universe@556: auto hmap = reinterpret_cast(map); universe@556: EXPECT_GT(hmap->bucket_count, 0); universe@556: cx_for_n(i, hmap->bucket_count) { universe@556: EXPECT_EQ(hmap->buckets[i], nullptr); universe@556: } universe@677: EXPECT_EQ(map->item_size, 1); universe@556: EXPECT_EQ(map->size, 0); universe@556: EXPECT_EQ(map->allocator, &allocator); universe@685: EXPECT_FALSE(map->store_pointer); universe@685: EXPECT_EQ(map->cmpfunc, nullptr); universe@685: EXPECT_EQ(map->simple_destructor, nullptr); universe@685: EXPECT_EQ(map->advanced_destructor, nullptr); universe@685: EXPECT_EQ(map->destructor_data, nullptr); universe@658: cxMapStorePointers(map); universe@685: EXPECT_TRUE(map->store_pointer); universe@677: EXPECT_EQ(map->item_size, sizeof(void *)); universe@658: cxMapStoreObjects(map); universe@685: EXPECT_FALSE(map->store_pointer); universe@556: universe@556: cxMapDestroy(map); universe@556: EXPECT_TRUE(allocator.verify()); universe@556: } universe@556: universe@668: TEST(CxHashMap, CreateForStoringPointers) { universe@668: CxTestingAllocator allocator; universe@668: auto map = cxHashMapCreate(&allocator, CX_STORE_POINTERS, 0); universe@668: auto hmap = reinterpret_cast(map); universe@668: EXPECT_GT(hmap->bucket_count, 0); universe@668: cx_for_n(i, hmap->bucket_count) { universe@668: EXPECT_EQ(hmap->buckets[i], nullptr); universe@668: } universe@668: EXPECT_EQ(map->size, 0); universe@668: EXPECT_EQ(map->allocator, &allocator); universe@685: EXPECT_TRUE(map->store_pointer); universe@677: EXPECT_EQ(map->item_size, sizeof(void *)); universe@668: universe@668: cxMapDestroy(map); universe@668: EXPECT_TRUE(allocator.verify()); universe@668: } universe@668: universe@556: TEST(CxHashMap, BasicOperations) { universe@556: // create the map universe@556: CxTestingAllocator allocator; universe@669: auto map = cxHashMapCreate(&allocator, CX_STORE_POINTERS, 8); universe@556: universe@556: // create a reference map universe@556: std::unordered_map refmap; universe@556: universe@556: // generate operations universe@556: auto ops = generate_map_operations(); universe@556: universe@556: // verify iterators for empty map universe@556: verify_map_contents(map, refmap); universe@556: universe@556: // execute operations and verify results universe@556: for (auto &&op: ops) { universe@563: CxHashKey key = cx_hash_key_str(op.key); universe@563: key.hash = 0; // force the hash map to compute the hash universe@556: if (op.op == map_operation::put) { universe@556: // execute a put operation and verify that the exact value can be read back universe@556: refmap[std::string(op.key)] = std::string(op.value); universe@556: int result = cxMapPut(map, key, (void *) op.value); universe@556: EXPECT_EQ(result, 0); universe@556: auto added = cxMapGet(map, key); universe@556: EXPECT_EQ(memcmp(op.value, added, strlen(op.value)), 0); universe@556: } else { universe@556: // execute a remove and verify that the removed element was returned (or nullptr) universe@556: auto found = refmap.find(op.key); universe@659: auto removed = cxMapRemoveAndGet(map, key); universe@556: if (found == refmap.end()) { universe@556: EXPECT_EQ(removed, nullptr); universe@556: } else { universe@556: EXPECT_EQ(std::string((char *) removed), found->second); universe@556: refmap.erase(found); universe@556: } universe@556: } universe@556: // compare the current map state with the reference map universe@556: verify_map_contents(map, refmap); universe@556: } universe@556: universe@556: // destroy the map and verify the memory (de)allocations universe@556: cxMapDestroy(map); universe@556: EXPECT_TRUE(allocator.verify()); universe@556: } universe@561: universe@561: TEST(CxHashMap, RemoveViaIterator) { universe@561: CxTestingAllocator allocator; universe@669: auto map = cxHashMapCreate(&allocator, CX_STORE_POINTERS, 4); universe@561: universe@691: cxMapPut(map, "key 1", (void *) "val 1"); universe@691: cxMapPut(map, "key 2", (void *) "val 2"); universe@691: cxMapPut(map, "key 3", (void *) "val 3"); universe@691: cxMapPut(map, "key 4", (void *) "val 4"); universe@691: cxMapPut(map, "key 5", (void *) "val 5"); universe@691: cxMapPut(map, "key 6", (void *) "val 6"); universe@561: universe@630: auto iter = cxMapMutIterator(map); universe@561: cx_foreach(CxMapEntry*, entry, iter) { universe@691: if (reinterpret_cast(entry->key->data)[4] % 2 == 1) cxIteratorFlagRemoval(iter); universe@561: } universe@561: EXPECT_EQ(map->size, 3); universe@561: EXPECT_EQ(iter.index, map->size); universe@561: universe@691: EXPECT_EQ(cxMapGet(map, "key 1"), nullptr); universe@691: EXPECT_NE(cxMapGet(map, "key 2"), nullptr); universe@691: EXPECT_EQ(cxMapGet(map, "key 3"), nullptr); universe@691: EXPECT_NE(cxMapGet(map, "key 4"), nullptr); universe@691: EXPECT_EQ(cxMapGet(map, "key 5"), nullptr); universe@691: EXPECT_NE(cxMapGet(map, "key 6"), nullptr); universe@561: universe@561: cxMapDestroy(map); universe@561: EXPECT_TRUE(allocator.verify()); universe@561: } universe@562: universe@562: TEST(CxHashMap, RehashNotRequired) { universe@562: CxTestingAllocator allocator; universe@669: auto map = cxHashMapCreate(&allocator, CX_STORE_POINTERS, 8); universe@562: universe@691: cxMapPut(map, "key 1", (void *) "val 1"); universe@691: cxMapPut(map, "key 2", (void *) "val 2"); universe@691: cxMapPut(map, "key 3", (void *) "val 3"); universe@691: cxMapPut(map, "key 4", (void *) "val 4"); universe@691: cxMapPut(map, "key 5", (void *) "val 5"); universe@691: cxMapPut(map, "key 6", (void *) "val 6"); universe@562: universe@562: // 6/8 does not exceed 0.75, therefore the function should not rehash universe@562: int result = cxMapRehash(map); universe@562: EXPECT_EQ(result, 0); universe@562: EXPECT_EQ(reinterpret_cast(map)->bucket_count, 8); universe@562: universe@562: cxMapDestroy(map); universe@562: EXPECT_TRUE(allocator.verify()); universe@562: } universe@562: universe@562: TEST(CxHashMap, Rehash) { universe@562: CxTestingAllocator allocator; universe@687: auto map = cxHashMapCreate(&allocator, CX_STORE_POINTERS, 7); universe@562: universe@691: cxMapPut(map, "key 1", (void *) "val 1"); universe@691: cxMapPut(map, "key 2", (void *) "val 2"); universe@691: cxMapPut(map, "key 3", (void *) "val 3"); universe@691: cxMapPut(map, "foo 4", (void *) "val 4"); universe@691: cxMapPut(map, "key 5", (void *) "val 5"); universe@691: cxMapPut(map, "key 6", (void *) "val 6"); universe@691: cxMapPut(map, "bar 7", (void *) "val 7"); universe@691: cxMapPut(map, "key 8", (void *) "val 8"); universe@691: cxMapPut(map, "key 9", (void *) "val 9"); universe@691: cxMapPut(map, "key 10", (void *) "val 10"); universe@562: universe@562: int result = cxMapRehash(map); universe@562: EXPECT_EQ(result, 0); universe@687: EXPECT_EQ(reinterpret_cast(map)->bucket_count, 25); universe@687: EXPECT_EQ(map->size, 10); universe@562: universe@691: EXPECT_STREQ((char *) cxMapGet(map, "key 1"), "val 1"); universe@691: EXPECT_STREQ((char *) cxMapGet(map, "key 2"), "val 2"); universe@691: EXPECT_STREQ((char *) cxMapGet(map, "key 3"), "val 3"); universe@691: EXPECT_STREQ((char *) cxMapGet(map, "foo 4"), "val 4"); universe@691: EXPECT_STREQ((char *) cxMapGet(map, "key 5"), "val 5"); universe@691: EXPECT_STREQ((char *) cxMapGet(map, "key 6"), "val 6"); universe@691: EXPECT_STREQ((char *) cxMapGet(map, "bar 7"), "val 7"); universe@691: EXPECT_STREQ((char *) cxMapGet(map, "key 8"), "val 8"); universe@691: EXPECT_STREQ((char *) cxMapGet(map, "key 9"), "val 9"); universe@691: EXPECT_STREQ((char *) cxMapGet(map, "key 10"), "val 10"); universe@562: universe@562: cxMapDestroy(map); universe@562: EXPECT_TRUE(allocator.verify()); universe@594: } universe@594: universe@594: TEST(CxHashMap, Clear) { universe@594: CxTestingAllocator allocator; universe@669: auto map = cxHashMapCreate(&allocator, CX_STORE_POINTERS, 0); universe@686: universe@691: cxMapPut(map, "key 1", (void *) "val 1"); universe@691: cxMapPut(map, "key 2", (void *) "val 2"); universe@691: cxMapPut(map, "key 3", (void *) "val 3"); universe@594: universe@594: EXPECT_EQ(map->size, 3); universe@594: universe@594: cxMapClear(map); universe@594: universe@594: EXPECT_EQ(map->size, 0); universe@691: EXPECT_EQ(cxMapGet(map, "key 1"), nullptr); universe@691: EXPECT_EQ(cxMapGet(map, "key 2"), nullptr); universe@691: EXPECT_EQ(cxMapGet(map, "key 3"), nullptr); universe@594: universe@594: cxMapDestroy(map); universe@594: EXPECT_TRUE(allocator.verify()); universe@658: } universe@658: universe@658: TEST(CxHashMap, StoreUcxStrings) { universe@658: // create the map universe@658: CxTestingAllocator allocator; universe@658: auto map = cxHashMapCreate(&allocator, sizeof(cxstring), 8); universe@658: universe@658: // define some strings universe@685: auto s1 = CX_STR("this"); universe@685: auto s2 = CX_STR("is"); universe@685: auto s3 = CX_STR("a"); universe@685: auto s4 = CX_STR("test"); universe@685: auto s5 = CX_STR("setup"); universe@658: universe@658: // put them into the map universe@691: cxMapPut(map, "s1", &s1); universe@691: cxMapPut(map, "s2", &s2); universe@691: cxMapPut(map, "s3", &s3); universe@691: cxMapPut(map, "s4", &s4); universe@658: universe@658: // overwrite a value universe@691: cxMapPut(map, "s1", &s5); universe@658: universe@658: // look up a string universe@691: auto s3p = reinterpret_cast(cxMapGet(map, "s3")); universe@658: EXPECT_EQ(s3p->length, s3.length); universe@658: EXPECT_EQ(s3p->ptr, s3.ptr); universe@658: EXPECT_NE(s3p, &s3); universe@658: universe@658: // remove a string universe@691: cxMapRemove(map, "s2"); universe@658: universe@658: // iterate universe@658: auto ref = std::vector{s5.ptr, s3.ptr, s4.ptr}; universe@658: auto iter = cxMapIteratorValues(map); universe@658: cx_foreach(cxstring*, s, iter) { universe@658: auto found = std::find(ref.begin(), ref.end(), s->ptr); universe@658: ASSERT_NE(found, ref.end()); universe@658: ref.erase(found); universe@658: } universe@658: EXPECT_EQ(ref.size(), 0); universe@658: universe@658: cxMapDestroy(map); universe@658: EXPECT_TRUE(allocator.verify()); universe@658: } universe@685: universe@686: static void test_simple_destructor(void *data) { universe@686: strcpy((char *) data, "OK"); universe@686: } universe@686: universe@686: static void test_advanced_destructor( universe@686: [[maybe_unused]] void *unused, universe@686: void *data universe@686: ) { universe@686: strcpy((char *) data, "OK"); universe@686: } universe@686: universe@686: static void verify_any_destructor(CxMap *map) { universe@686: auto k1 = cx_hash_key_str("key 1"); universe@686: auto k2 = cx_hash_key_str("key 2"); universe@686: auto k3 = cx_hash_key_str("key 3"); universe@686: auto k4 = cx_hash_key_str("key 4"); universe@686: auto k5 = cx_hash_key_str("key 5"); universe@686: universe@686: char v1[] = "val 1"; universe@686: char v2[] = "val 2"; universe@686: char v3[] = "val 3"; universe@686: char v4[] = "val 4"; universe@686: char v5[] = "val 5"; universe@686: universe@686: cxMapPut(map, k1, (void *) v1); universe@686: cxMapPut(map, k2, (void *) v2); universe@686: cxMapPut(map, k3, (void *) v3); universe@686: cxMapPut(map, k4, (void *) v4); universe@686: universe@686: cxMapRemove(map, k2); universe@686: auto r = cxMapRemoveAndGet(map, k3); universe@686: cxMapDetach(map, k1); universe@686: universe@686: EXPECT_STREQ(v1, "val 1"); universe@686: EXPECT_STREQ(v2, "OK"); universe@686: EXPECT_STREQ(v3, "val 3"); universe@686: EXPECT_STREQ(v4, "val 4"); universe@686: EXPECT_STREQ(v5, "val 5"); universe@686: EXPECT_EQ(r, v3); universe@686: universe@686: cxMapClear(map); universe@686: universe@686: EXPECT_STREQ(v1, "val 1"); universe@686: EXPECT_STREQ(v2, "OK"); universe@686: EXPECT_STREQ(v3, "val 3"); universe@686: EXPECT_STREQ(v4, "OK"); universe@686: EXPECT_STREQ(v5, "val 5"); universe@686: universe@686: cxMapPut(map, k1, (void *) v1); universe@686: cxMapPut(map, k3, (void *) v3); universe@686: cxMapPut(map, k5, (void *) v5); universe@686: universe@686: { universe@686: auto iter = cxMapMutIteratorKeys(map); universe@686: cx_foreach(CxHashKey*, key, iter) { universe@691: if (reinterpret_cast(key->data)[4] == '1') cxIteratorFlagRemoval(iter); universe@686: } universe@686: } universe@686: { universe@686: auto iter = cxMapMutIteratorValues(map); universe@686: cx_foreach(char*, v, iter) { universe@686: if (v[4] == '5') cxIteratorFlagRemoval(iter); universe@686: } universe@686: } universe@686: universe@686: EXPECT_STREQ(v1, "OK"); universe@686: EXPECT_STREQ(v2, "OK"); universe@686: EXPECT_STREQ(v3, "val 3"); universe@686: EXPECT_STREQ(v4, "OK"); universe@686: EXPECT_STREQ(v5, "OK"); universe@686: universe@686: v1[0] = v2[0] = v4[0] = v5[0] = 'c'; universe@686: universe@686: cxMapDestroy(map); universe@686: universe@686: EXPECT_STREQ(v1, "cK"); universe@686: EXPECT_STREQ(v2, "cK"); universe@686: EXPECT_STREQ(v3, "OK"); universe@686: EXPECT_STREQ(v4, "cK"); universe@686: EXPECT_STREQ(v5, "cK"); universe@686: } universe@686: universe@686: TEST(CxHashMap, SimpleDestructor) { universe@686: CxTestingAllocator allocator; universe@686: auto map = cxHashMapCreate(&allocator, CX_STORE_POINTERS, 0); universe@686: map->simple_destructor = test_simple_destructor; universe@686: verify_any_destructor(map); universe@686: EXPECT_TRUE(allocator.verify()); universe@686: } universe@686: universe@686: TEST(CxHashMap, AdvancedDestructor) { universe@686: CxTestingAllocator allocator; universe@686: auto map = cxHashMapCreate(&allocator, CX_STORE_POINTERS, 0); universe@686: map->advanced_destructor = test_advanced_destructor; universe@686: verify_any_destructor(map); universe@686: EXPECT_TRUE(allocator.verify()); universe@686: } universe@691: universe@691: TEST(CxHashMap, Generics) { universe@691: CxTestingAllocator allocator; universe@691: auto map = test_map_generics_step_1(&allocator); universe@691: universe@691: EXPECT_EQ(map->size, 3); universe@691: EXPECT_STREQ((char *) cxMapGet(map, "test"), "test"); universe@691: EXPECT_STREQ((char *) cxMapGet(map, "foo"), "bar"); universe@691: EXPECT_STREQ((char *) cxMapGet(map, "hallo"), "welt"); universe@691: universe@691: test_map_generics_step_2(map); universe@691: universe@691: EXPECT_EQ(map->size, 2); universe@691: EXPECT_STREQ((char *) cxMapGet(map, "key"), "value"); universe@691: EXPECT_STREQ((char *) cxMapGet(map, "foo"), "bar"); universe@691: universe@691: test_map_generics_step_3(map); universe@691: universe@691: EXPECT_EQ(map->size, 0); universe@691: universe@691: cxMapDestroy(map); universe@691: EXPECT_TRUE(allocator.verify()); universe@691: } universe@706: universe@706: TEST(EmptyMap, Size) { universe@706: auto map = cxEmptyMap; universe@706: universe@706: EXPECT_EQ(map->size, 0); universe@706: } universe@706: universe@706: TEST(EmptyMap, Iterator) { universe@706: auto map = cxEmptyMap; universe@706: universe@706: auto it1 = cxMapIterator(map); universe@706: auto it2 = cxMapIteratorValues(map); universe@706: auto it3 = cxMapIteratorKeys(map); universe@706: auto it4 = cxMapMutIterator(map); universe@706: auto it5 = cxMapMutIteratorValues(map); universe@706: auto it6 = cxMapMutIteratorKeys(map); universe@706: universe@706: EXPECT_FALSE(cxIteratorValid(it1)); universe@706: EXPECT_FALSE(cxIteratorValid(it2)); universe@706: EXPECT_FALSE(cxIteratorValid(it3)); universe@706: EXPECT_FALSE(cxIteratorValid(it4)); universe@706: EXPECT_FALSE(cxIteratorValid(it5)); universe@706: EXPECT_FALSE(cxIteratorValid(it6)); universe@706: universe@706: int c = 0; universe@706: cx_foreach(void*, data, it1) c++; universe@706: cx_foreach(void*, data, it2) c++; universe@706: cx_foreach(void*, data, it3) c++; universe@706: cx_foreach(void*, data, it4) c++; universe@706: cx_foreach(void*, data, it5) c++; universe@706: cx_foreach(void*, data, it6) c++; universe@706: EXPECT_EQ(c, 0); universe@706: } universe@706: universe@706: TEST(EmptyMap, NoOps) { universe@706: auto map = cxEmptyMap; universe@706: universe@706: ASSERT_NO_FATAL_FAILURE(cxMapClear(map)); universe@706: ASSERT_NO_FATAL_FAILURE(cxMapDestroy(map)); universe@706: } universe@706: universe@706: TEST(EmptyMap, Get) { universe@706: auto map = cxEmptyMap; universe@706: universe@706: CxHashKey key = cx_hash_key_str("test"); universe@706: EXPECT_EQ(cxMapGet(map, key), nullptr); universe@706: }