From e6e7530d10b74d763b4311ea93e0a831b810d6c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 13 Apr 2016 20:22:42 +0700 Subject: test helpers: move test-* to t/helper/ subdirectory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This keeps top dir a bit less crowded. And because these programs are for testing purposes, it makes sense that they stay somewhere in t/ Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- test-sha1-array.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 test-sha1-array.c (limited to 'test-sha1-array.c') diff --git a/test-sha1-array.c b/test-sha1-array.c deleted file mode 100644 index 60ea1d5f14..0000000000 --- a/test-sha1-array.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "cache.h" -#include "sha1-array.h" - -static void print_sha1(const unsigned char sha1[20], void *data) -{ - puts(sha1_to_hex(sha1)); -} - -int main(int argc, char **argv) -{ - struct sha1_array array = SHA1_ARRAY_INIT; - struct strbuf line = STRBUF_INIT; - - while (strbuf_getline(&line, stdin) != EOF) { - const char *arg; - unsigned char sha1[20]; - - if (skip_prefix(line.buf, "append ", &arg)) { - if (get_sha1_hex(arg, sha1)) - die("not a hexadecimal SHA1: %s", arg); - sha1_array_append(&array, sha1); - } else if (skip_prefix(line.buf, "lookup ", &arg)) { - if (get_sha1_hex(arg, sha1)) - die("not a hexadecimal SHA1: %s", arg); - printf("%d\n", sha1_array_lookup(&array, sha1)); - } else if (!strcmp(line.buf, "clear")) - sha1_array_clear(&array); - else if (!strcmp(line.buf, "for_each_unique")) - sha1_array_for_each_unique(&array, print_sha1, NULL); - else - die("unknown command: %s", line.buf); - } - return 0; -} -- cgit v1.2.1