Skip to content

Commit 7c18cbd

Browse files
pcloudsgitster
authored andcommitted
t/helper: merge test-hashmap into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c680668 commit 7c18cbd

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,13 +662,13 @@ TEST_BUILTINS_OBJS += test-dump-cache-tree.o
662662
TEST_BUILTINS_OBJS += test-dump-split-index.o
663663
TEST_BUILTINS_OBJS += test-example-decorate.o
664664
TEST_BUILTINS_OBJS += test-genrandom.o
665+
TEST_BUILTINS_OBJS += test-hashmap.o
665666
TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
666667
TEST_BUILTINS_OBJS += test-sha1.o
667668

668669
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
669670
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
670671
TEST_PROGRAMS_NEED_X += test-fake-ssh
671-
TEST_PROGRAMS_NEED_X += test-hashmap
672672
TEST_PROGRAMS_NEED_X += test-index-version
673673
TEST_PROGRAMS_NEED_X += test-line-buffer
674674
TEST_PROGRAMS_NEED_X += test-match-trees

t/helper/test-hashmap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "test-tool.h"
12
#include "git-compat-util.h"
23
#include "hashmap.h"
34
#include "strbuf.h"
@@ -77,7 +78,7 @@ static unsigned int hash(unsigned int method, unsigned int i, const char *key)
7778

7879
/*
7980
* Test performance of hashmap.[ch]
80-
* Usage: time echo "perfhashmap method rounds" | test-hashmap
81+
* Usage: time echo "perfhashmap method rounds" | test-tool hashmap
8182
*/
8283
static void perf_hashmap(unsigned int method, unsigned int rounds)
8384
{
@@ -144,7 +145,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds)
144145
*
145146
* perfhashmap method rounds -> test hashmap.[ch] performance
146147
*/
147-
int cmd_main(int argc, const char **argv)
148+
int cmd__hashmap(int argc, const char **argv)
148149
{
149150
struct strbuf line = STRBUF_INIT;
150151
struct hashmap map;

t/helper/test-tool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ static struct test_cmd cmds[] = {
1717
{ "dump-split-index", cmd__dump_split_index },
1818
{ "example-decorate", cmd__example_decorate },
1919
{ "genrandom", cmd__genrandom },
20+
{ "hashmap", cmd__hashmap },
2021
{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
2122
{ "sha1", cmd__sha1 },
2223
};

t/helper/test-tool.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ int cmd__dump_cache_tree(int argc, const char **argv);
1111
int cmd__dump_split_index(int argc, const char **argv);
1212
int cmd__example_decorate(int argc, const char **argv);
1313
int cmd__genrandom(int argc, const char **argv);
14+
int cmd__hashmap(int argc, const char **argv);
1415
int cmd__lazy_init_name_hash(int argc, const char **argv);
1516
int cmd__sha1(int argc, const char **argv);
1617

t/t0011-hashmap.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_description='test hashmap and string hash functions'
44
. ./test-lib.sh
55

66
test_hashmap() {
7-
echo "$1" | test-hashmap $3 > actual &&
7+
echo "$1" | test-tool hashmap $3 > actual &&
88
echo "$2" > expect &&
99
test_cmp expect actual
1010
}
@@ -232,7 +232,7 @@ test_expect_success 'grow / shrink' '
232232
echo value40 >> expect &&
233233
echo size >> in &&
234234
echo 64 39 >> expect &&
235-
cat in | test-hashmap > out &&
235+
cat in | test-tool hashmap > out &&
236236
test_cmp expect out
237237
238238
'

0 commit comments

Comments
 (0)