MCPcopy Index your code
hub / github.com/git/git / t_replace

Function t_replace

t/unit-tests/u-hashmap.c:81–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81static void t_replace(struct hashmap *map, unsigned int ignore_case)
82{
83 struct test_entry *entry;
84
85 entry = alloc_test_entry("key1", "value1", ignore_case);
86 cl_assert_equal_p(hashmap_put_entry(map, entry, ent), NULL);
87
88 entry = alloc_test_entry(ignore_case ? "Key1" : "key1", "value2",
89 ignore_case);
90 entry = hashmap_put_entry(map, entry, ent);
91 cl_assert(entry != NULL);
92 cl_assert_equal_s(get_value(entry), "value1");
93 free(entry);
94
95 entry = alloc_test_entry("fooBarFrotz", "value3", ignore_case);
96 cl_assert_equal_p(hashmap_put_entry(map, entry, ent), NULL);
97
98 entry = alloc_test_entry(ignore_case ? "FOObarFrotz" : "fooBarFrotz",
99 "value4", ignore_case);
100 entry = hashmap_put_entry(map, entry, ent);
101 cl_assert(entry != NULL);
102 cl_assert_equal_s(get_value(entry), "value3");
103 free(entry);
104}
105
106static void t_get(struct hashmap *map, unsigned int ignore_case)
107{

Callers

nothing calls this directly

Calls 2

alloc_test_entryFunction · 0.70
get_valueFunction · 0.70

Tested by

no test coverage detected