]> git.ipfire.org Git - thirdparty/git.git/blob - t/helper/test-tool.c
t/helper: merge test-genrandom into test-tool
[thirdparty/git.git] / t / helper / test-tool.c
1 #include "git-compat-util.h"
2 #include "test-tool.h"
3
4 struct test_cmd {
5 const char *name;
6 int (*fn)(int argc, const char **argv);
7 };
8
9 static struct test_cmd cmds[] = {
10 { "chmtime", cmd__chmtime },
11 { "config", cmd__config },
12 { "ctype", cmd__ctype },
13 { "date", cmd__date },
14 { "delta", cmd__delta },
15 { "drop-caches", cmd__drop_caches },
16 { "dump-cache-tree", cmd__dump_cache_tree },
17 { "dump-split-index", cmd__dump_split_index },
18 { "example-decorate", cmd__example_decorate },
19 { "genrandom", cmd__genrandom },
20 { "lazy-init-name-hash", cmd__lazy_init_name_hash },
21 { "sha1", cmd__sha1 },
22 };
23
24 int cmd_main(int argc, const char **argv)
25 {
26 int i;
27
28 if (argc < 2)
29 die("I need a test name!");
30
31 for (i = 0; i < ARRAY_SIZE(cmds); i++) {
32 if (!strcmp(cmds[i].name, argv[1])) {
33 argv++;
34 argc--;
35 return cmds[i].fn(argc, argv);
36 }
37 }
38 die("There is no test named '%s'", argv[1]);
39 }