Skip to content

Commit a1100d2

Browse files
chriscoolgitster
authored andcommitted
test-hashmap: remove 'hash' command
If hashes like strhash() are updated, for example to use a different hash algorithm, we should not have to be updating t0011 to change out the hashes. As long as hashmap can store and retrieve values, and that it performs well, we should not care what are the values of the hashes. Let's just focus on the externally visible behavior instead. Suggested-by: Jeff King <[email protected]> Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 19cfa0e commit a1100d2

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

t/helper/test-hashmap.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,7 @@ int cmd__hashmap(int argc, const char **argv)
173173
p2 = strtok(NULL, DELIM);
174174
}
175175

176-
if (!strcmp("hash", cmd) && p1) {
177-
178-
/* print results of different hash functions */
179-
printf("%u %u %u %u\n",
180-
strhash(p1), memhash(p1, strlen(p1)),
181-
strihash(p1), memihash(p1, strlen(p1)));
182-
183-
} else if (!strcmp("add", cmd) && p1 && p2) {
176+
if (!strcmp("add", cmd) && p1 && p2) {
184177

185178
/* create entry with key = p1, value = p2 */
186179
entry = alloc_test_entry(hash, p1, p2);

t/t0011-hashmap.sh

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ test_hashmap() {
99
test_cmp expect actual
1010
}
1111

12-
test_expect_success 'hash functions' '
13-
14-
test_hashmap "hash key1" "2215982743 2215982743 116372151 116372151" &&
15-
test_hashmap "hash key2" "2215982740 2215982740 116372148 116372148" &&
16-
test_hashmap "hash fooBarFrotz" "1383912807 1383912807 3189766727 3189766727" &&
17-
test_hashmap "hash foobarfrotz" "2862305959 2862305959 3189766727 3189766727"
18-
19-
'
20-
2112
test_expect_success 'put' '
2213
2314
test_hashmap "put key1 value1

0 commit comments

Comments
 (0)