summaryrefslogtreecommitdiff
path: root/test-string-pool.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-08-31 16:23:38 -0700
committerJunio C Hamano <gitster@pobox.com>2010-08-31 16:23:38 -0700
commitaca35505db3706c87d391dd213e856f73edfd42c (patch)
tree80b2d3878ae3ff21db1b1c21b9eaa6fefc290550 /test-string-pool.c
parentd7cc7c971f58091a2f2a15d2dca0fab0bd2ca310 (diff)
parentcd9a7b57a7118672441f9e9670a9fbb42249cf67 (diff)
downloadgit-aca35505db3706c87d391dd213e856f73edfd42c.tar.gz
Merge branch 'jn/svn-fe'
* jn/svn-fe: t/t9010-svn-fe.sh: add an +x bit to this test t9010 (svn-fe): avoid symlinks in test t9010 (svn-fe): use Unix-style path in URI vcs-svn: Avoid %z in format string vcs-svn: Rename dirent pool to build on Windows compat: add strtok_r() treap: style fix vcs-svn: remove build artifacts on "make clean" svn-fe manual: Clarify warning about deltas in dump files Update svn-fe manual SVN dump parser Infrastructure to write revisions in fast-export format Add stream helper library Add string-specific memory pool Add treap implementation Add memory pool library Introduce vcs-svn lib
Diffstat (limited to 'test-string-pool.c')
-rw-r--r--test-string-pool.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/test-string-pool.c b/test-string-pool.c
new file mode 100644
index 0000000000..c5782e6bce
--- /dev/null
+++ b/test-string-pool.c
@@ -0,0 +1,31 @@
+/*
+ * test-string-pool.c: code to exercise the svn importer's string pool
+ */
+
+#include "git-compat-util.h"
+#include "vcs-svn/string_pool.h"
+
+int main(int argc, char *argv[])
+{
+ const uint32_t unequal = pool_intern("does not equal");
+ const uint32_t equal = pool_intern("equals");
+ uint32_t buf[3];
+ uint32_t n;
+
+ if (argc != 2)
+ usage("test-string-pool <string>,<string>");
+
+ n = pool_tok_seq(3, buf, ",-", argv[1]);
+ if (n >= 3)
+ die("too many strings");
+ if (n <= 1)
+ die("too few strings");
+
+ buf[2] = buf[1];
+ buf[1] = (buf[0] == buf[2]) ? equal : unequal;
+ pool_print_seq(3, buf, ' ', stdout);
+ fputc('\n', stdout);
+
+ pool_reset();
+ return 0;
+}