MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / test_empty_map

Function test_empty_map

tests/unit/test_map.c:19–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17#include "acutest.h"
18
19void test_empty_map() {
20 SIValue map = Map_New(2);
21
22 //--------------------------------------------------------------------------
23 // map should be empty
24 //--------------------------------------------------------------------------
25
26 TEST_ASSERT(0 == Map_KeyCount(map));
27
28 SIValue keys = Map_Keys(map);
29 TEST_ASSERT(0 == SIArray_Length(keys));
30 SIArray_Free(keys);
31
32 //--------------------------------------------------------------------------
33 // try getting a key
34 //--------------------------------------------------------------------------
35
36 SIValue key = SI_ConstStringVal("k");
37 SIValue v;
38 TEST_ASSERT(!Map_Contains(map, key));
39 TEST_ASSERT(!Map_Get(map, key, &v));
40
41 //--------------------------------------------------------------------------
42 // try removing a none existing key
43 //--------------------------------------------------------------------------
44
45 Map_Remove(map, key);
46
47 // clean up
48 Map_Free(map);
49}
50
51void test_map_add() {
52 SIValue map = Map_New(2);

Callers

nothing calls this directly

Calls 10

Map_NewFunction · 0.85
Map_KeyCountFunction · 0.85
Map_KeysFunction · 0.85
SIArray_LengthFunction · 0.85
SIArray_FreeFunction · 0.85
SI_ConstStringValFunction · 0.85
Map_ContainsFunction · 0.85
Map_GetFunction · 0.85
Map_RemoveFunction · 0.85
Map_FreeFunction · 0.85

Tested by

no test coverage detected