test-hashmap: remove 'hash' command
authorChristian Couder <christian.couder@gmail.com>
Sat, 15 Jun 2019 10:07:02 +0000 (12:07 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Jun 2019 01:11:42 +0000 (18:11 -0700)
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 <peff@peff.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-hashmap.c
t/t0011-hashmap.sh
index 23d2b172fe708f711a15613e906637cd948324ef..aaf17b0ddf9e8ddd1270f613f8c71841c6644eb9 100644 (file)
@@ -173,14 +173,7 @@ int cmd__hashmap(int argc, const char **argv)
                        p2 = strtok(NULL, DELIM);
                }
 
-               if (!strcmp("hash", cmd) && p1) {
-
-                       /* print results of different hash functions */
-                       printf("%u %u %u %u\n",
-                              strhash(p1), memhash(p1, strlen(p1)),
-                              strihash(p1), memihash(p1, strlen(p1)));
-
-               } else if (!strcmp("add", cmd) && p1 && p2) {
+               if (!strcmp("add", cmd) && p1 && p2) {
 
                        /* create entry with key = p1, value = p2 */
                        entry = alloc_test_entry(hash, p1, p2);
index 3f1f505e8937f391666a1b7e6d9b972a5f146974..9c96b3e3b10a99c20a1e6f5d4d0349c4fbcb0a10 100755 (executable)
@@ -9,15 +9,6 @@ test_hashmap() {
        test_cmp expect actual
 }
 
-test_expect_success 'hash functions' '
-
-test_hashmap "hash key1" "2215982743 2215982743 116372151 116372151" &&
-test_hashmap "hash key2" "2215982740 2215982740 116372148 116372148" &&
-test_hashmap "hash fooBarFrotz" "1383912807 1383912807 3189766727 3189766727" &&
-test_hashmap "hash foobarfrotz" "2862305959 2862305959 3189766727 3189766727"
-
-'
-
 test_expect_success 'put' '
 
 test_hashmap "put key1 value1