t/helper: merge test-hashmap into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Mar 24, 2018 at 08:44 UTC
7c18cbd562af9f00877baad5f46b057d47b1c493
5 files changed
+8
-5
Makefile
+1
-1
@@ -662,13 +662,13 @@ TEST_BUILTINS_OBJS += test-dump-cache-tree.o
662
TEST_BUILTINS_OBJS += test-dump-split-index.o
663
TEST_BUILTINS_OBJS += test-example-decorate.o
664
TEST_BUILTINS_OBJS += test-genrandom.o
665
+TEST_BUILTINS_OBJS += test-hashmap.o
666
TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
667
TEST_BUILTINS_OBJS += test-sha1.o
668
669
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
670
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
671
TEST_PROGRAMS_NEED_X += test-fake-ssh
671
-TEST_PROGRAMS_NEED_X += test-hashmap
672
TEST_PROGRAMS_NEED_X += test-index-version
673
TEST_PROGRAMS_NEED_X += test-line-buffer
674
TEST_PROGRAMS_NEED_X += test-match-trees
t/helper/test-hashmap.c
+3
-2
@@ -1,3 +1,4 @@
1
+#include "test-tool.h"
2
#include "git-compat-util.h"
3
#include "hashmap.h"
4
#include "strbuf.h"
@@ -77,7 +78,7 @@ static unsigned int hash(unsigned int method, unsigned int i, const char *key)
78
79
/*
80
* Test performance of hashmap.[ch]
80
- * Usage: time echo "perfhashmap method rounds" | test-hashmap
81
+ * Usage: time echo "perfhashmap method rounds" | test-tool hashmap
82
*/
83
static void perf_hashmap(unsigned int method, unsigned int rounds)
84
{
@@ -144,7 +145,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds)
145
*
146
* perfhashmap method rounds -> test hashmap.[ch] performance
147
*/
147
-int cmd_main(int argc, const char **argv)
148
+int cmd__hashmap(int argc, const char **argv)
149
{
150
struct strbuf line = STRBUF_INIT;
151
struct hashmap map;
t/helper/test-tool.c
+1
@@ -17,6 +17,7 @@ static struct test_cmd cmds[] = {
17
{ "dump-split-index", cmd__dump_split_index },
18
{ "example-decorate", cmd__example_decorate },
19
{ "genrandom", cmd__genrandom },
20
+ { "hashmap", cmd__hashmap },
21
{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
22
{ "sha1", cmd__sha1 },
23
};
t/helper/test-tool.h
+1
@@ -11,6 +11,7 @@ int cmd__dump_cache_tree(int argc, const char **argv);
11
int cmd__dump_split_index(int argc, const char **argv);
12
int cmd__example_decorate(int argc, const char **argv);
13
int cmd__genrandom(int argc, const char **argv);
14
+int cmd__hashmap(int argc, const char **argv);
15
int cmd__lazy_init_name_hash(int argc, const char **argv);
16
int cmd__sha1(int argc, const char **argv);
17
t/t0011-hashmap.sh
+2
-2
@@ -4,7 +4,7 @@ test_description='test hashmap and string hash functions'
4
. ./test-lib.sh
5
6
test_hashmap() {
7
- echo "$1" | test-hashmap $3 > actual &&
7
+ echo "$1" | test-tool hashmap $3 > actual &&
8
echo "$2" > expect &&
9
test_cmp expect actual
10
}
@@ -232,7 +232,7 @@ test_expect_success 'grow / shrink' '
232
echo value40 >> expect &&
233
echo size >> in &&
234
echo 64 39 >> expect &&
235
- cat in | test-hashmap > out &&
235
+ cat in | test-tool hashmap > out &&
236
test_cmp expect out
237
238
'