test-string-pool.con commit Merge branch 'jc/maint-add-p-overlapping-hunks' into maint (c69e8b6)
   1/*
   2 * test-string-pool.c: code to exercise the svn importer's string pool
   3 */
   4
   5#include "git-compat-util.h"
   6#include "vcs-svn/string_pool.h"
   7
   8int main(int argc, char *argv[])
   9{
  10        const uint32_t unequal = pool_intern("does not equal");
  11        const uint32_t equal = pool_intern("equals");
  12        uint32_t buf[3];
  13        uint32_t n;
  14
  15        if (argc != 2)
  16                usage("test-string-pool <string>,<string>");
  17
  18        n = pool_tok_seq(3, buf, ",-", argv[1]);
  19        if (n >= 3)
  20                die("too many strings");
  21        if (n <= 1)
  22                die("too few strings");
  23
  24        buf[2] = buf[1];
  25        buf[1] = (buf[0] == buf[2]) ? equal : unequal;
  26        pool_print_seq(3, buf, ' ', stdout);
  27        fputc('\n', stdout);
  28
  29        pool_reset();
  30        return 0;
  31}