diff options
Diffstat (limited to 'ccan/strgrp/test/helpers.h')
-rw-r--r-- | ccan/strgrp/test/helpers.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ccan/strgrp/test/helpers.h b/ccan/strgrp/test/helpers.h new file mode 100644 index 00000000..8a754b0c --- /dev/null +++ b/ccan/strgrp/test/helpers.h @@ -0,0 +1,29 @@ +#ifndef STRGRP_TEST_HELPERS +#define STRGRP_TEST_HELPERS +#include <stdbool.h> +#include "ccan/str/str.h" +#include "ccan/tap/tap.h" +#include "../strgrp.h" + +#define DEFAULT_SIMILARITY 0.85 + +#define create(dst, similarity) \ + do { \ + dst = strgrp_new(similarity); \ + if (!dst) { \ + fail("strgrp_new() returned NULL reference"); \ + return 1; \ + } \ + } while (0) + +int +one_group_from_two(struct strgrp *ctx, + const char *const k1, void *v1, + const char *const k2, void *v2); + +int +two_groups_from_two(struct strgrp *ctx, + const char *const k1, void *v1, + const char *const k2, void *v2); + +#endif /* STRGRP_TEST_HELPERS */ |