]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/helper: merge test-prio-queue into test-tool
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sat, 24 Mar 2018 07:44:50 +0000 (08:44 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 27 Mar 2018 15:45:47 +0000 (08:45 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
t/helper/test-prio-queue.c
t/helper/test-tool.c
t/helper/test-tool.h
t/t0009-prio-queue.sh

index 751ea6cad746a39e9973e3291f00b346b0cef718..076c7784947d98c4b5715bc1799f12c6ce29cd79 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -670,6 +670,7 @@ TEST_BUILTINS_OBJS += test-mergesort.o
 TEST_BUILTINS_OBJS += test-mktemp.o
 TEST_BUILTINS_OBJS += test-online-cpus.o
 TEST_BUILTINS_OBJS += test-path-utils.o
+TEST_BUILTINS_OBJS += test-prio-queue.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -677,7 +678,6 @@ TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
-TEST_PROGRAMS_NEED_X += test-prio-queue
 TEST_PROGRAMS_NEED_X += test-read-cache
 TEST_PROGRAMS_NEED_X += test-write-cache
 TEST_PROGRAMS_NEED_X += test-ref-store
index ae58fff35972a09c08a47d2bc0abb67c96ba20eb..9807b649b14c0002bee6d10b200c27bb89a54812 100644 (file)
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "prio-queue.h"
 
@@ -16,7 +17,7 @@ static void show(int *v)
        free(v);
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__prio_queue(int argc, const char **argv)
 {
        struct prio_queue pq = { intcmp };
 
index baec861cc248b9a3f940944574bd140e6849bccc..64af0bbe94f1661436ba0de176c67a49008a0c04 100644 (file)
@@ -25,6 +25,7 @@ static struct test_cmd cmds[] = {
        { "mktemp", cmd__mktemp },
        { "online-cpus", cmd__online_cpus },
        { "path-utils", cmd__path_utils },
+       { "prio-queue", cmd__prio_queue },
        { "sha1", cmd__sha1 },
 };
 
index 3b7ced01f5154df550f583cdff2f15398210e34c..900c96dc0274045cdfbda09c47059327c795219f 100644 (file)
@@ -19,6 +19,7 @@ int cmd__mergesort(int argc, const char **argv);
 int cmd__mktemp(int argc, const char **argv);
 int cmd__online_cpus(int argc, const char **argv);
 int cmd__path_utils(int argc, const char **argv);
+int cmd__prio_queue(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
index 94045c3fad18d94e0e83acf757594cede066134b..e56dfce6680298c133bc2b2de12d9492fda66b7a 100755 (executable)
@@ -17,7 +17,7 @@ cat >expect <<'EOF'
 10
 EOF
 test_expect_success 'basic ordering' '
-       test-prio-queue 2 6 3 10 9 5 7 4 5 8 1 dump >actual &&
+       test-tool prio-queue 2 6 3 10 9 5 7 4 5 8 1 dump >actual &&
        test_cmp expect actual
 '
 
@@ -30,7 +30,7 @@ cat >expect <<'EOF'
 6
 EOF
 test_expect_success 'mixed put and get' '
-       test-prio-queue 6 2 4 get 5 3 get get 1 dump >actual &&
+       test-tool prio-queue 6 2 4 get 5 3 get get 1 dump >actual &&
        test_cmp expect actual
 '
 
@@ -43,7 +43,7 @@ NULL
 NULL
 EOF
 test_expect_success 'notice empty queue' '
-       test-prio-queue 1 2 get get get 1 2 get get get >actual &&
+       test-tool prio-queue 1 2 get get get 1 2 get get get >actual &&
        test_cmp expect actual
 '