summaryrefslogtreecommitdiff
path: root/ccan/strgrp/test/helpers.h
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2015-08-20 15:46:31 +0930
committerRusty Russell <rusty@rustcorp.com.au>2015-09-09 04:31:39 +0930
commit7c7ad8cc84eb75d83222fb269d9c117c12c8e75c (patch)
tree0aacd9aa6abf762496fe29d2bb1b3462f3ce6ba7 /ccan/strgrp/test/helpers.h
parent4ad5144790a12523f8a7c24c469a34907b6942a6 (diff)
strgrp: new module
Diffstat (limited to 'ccan/strgrp/test/helpers.h')
-rw-r--r--ccan/strgrp/test/helpers.h29
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 */