t/helper: merge test-sha1-array into test-tool
[git/git.git] / t / helper / test-tool.c
CommitLineData
efd71f89
NTND
1#include "git-compat-util.h"
2#include "test-tool.h"
3
4struct test_cmd {
5 const char *name;
6 int (*fn)(int argc, const char **argv);
7};
8
9static struct test_cmd cmds[] = {
0e496492 10 { "chmtime", cmd__chmtime },
0e2678af 11 { "config", cmd__config },
e4998944 12 { "ctype", cmd__ctype },
a801a7cf 13 { "date", cmd__date },
9153dde5 14 { "delta", cmd__delta },
1c854745 15 { "drop-caches", cmd__drop_caches },
06ccb29e 16 { "dump-cache-tree", cmd__dump_cache_tree },
8133061e 17 { "dump-split-index", cmd__dump_split_index },
dbceb3ec 18 { "example-decorate", cmd__example_decorate },
c680668d 19 { "genrandom", cmd__genrandom },
7c18cbd5 20 { "hashmap", cmd__hashmap },
cc6f663d 21 { "index-version", cmd__index_version },
64eb82fe 22 { "lazy-init-name-hash", cmd__lazy_init_name_hash },
9080e75f 23 { "match-trees", cmd__match_trees },
34889d3c 24 { "mergesort", cmd__mergesort },
d9cc2c87 25 { "mktemp", cmd__mktemp },
c033cc15 26 { "online-cpus", cmd__online_cpus },
b8d5cf4f 27 { "path-utils", cmd__path_utils },
15b75817 28 { "prio-queue", cmd__prio_queue },
5fbe600c 29 { "read-cache", cmd__read_cache },
65370d81 30 { "ref-store", cmd__ref_store },
9038531f 31 { "regex", cmd__regex },
77d4b8c8 32 { "revision-walking", cmd__revision_walking },
ae6a51f5 33 { "run-command", cmd__run_command },
ff5fb8b0 34 { "scrap-cache-tree", cmd__scrap_cache_tree },
aa218dff 35 { "sha1-array", cmd__sha1_array },
dae2ff9b 36 { "sha1", cmd__sha1 },
efd71f89
NTND
37};
38
39int cmd_main(int argc, const char **argv)
40{
41 int i;
42
43 if (argc < 2)
44 die("I need a test name!");
45
46 for (i = 0; i < ARRAY_SIZE(cmds); i++) {
47 if (!strcmp(cmds[i].name, argv[1])) {
48 argv++;
49 argc--;
50 return cmds[i].fn(argc, argv);
51 }
52 }
53 die("There is no test named '%s'", argv[1]);
54}