From 32a4456cc252689f51f383d150d34ed636bfec4d Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Wed, 15 Oct 2014 11:00:46 +0200 Subject: test: generate tests for OrderedHashmap from Hashmap tests test-hashmap-ordered.c is generated from test-hashmap-plain.c simply by substituting "ordered_hashmap" for "hashmap" etc. In the cases where tests rely on the order of entries, a distinction between plain and ordered hashmaps is made using the ORDERED macro, which is defined only for test-hashmap-ordered.c. --- Makefile.am | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'Makefile.am') diff --git a/Makefile.am b/Makefile.am index 3b0ba0ae3..4d93304cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1569,8 +1569,27 @@ test_namespace_SOURCES = \ test_namespace_LDADD = \ libsystemd-core.la +CLEANFILES += \ + src/test/test-hashmap-ordered.c + +BUILT_SOURCES += \ + src/test/test-hashmap-ordered.c + +src/test/test-hashmap-ordered.c: src/test/test-hashmap-plain.c + $(AM_V_at)$(MKDIR_P) $(dir $@) + $(AM_V_GEN)$(AWK) 'BEGIN { print "/* GENERATED FILE */\n#define ORDERED" } \ + { if (!match($$0, "^#include")) \ + gsub(/hashmap/, "ordered_hashmap"); \ + gsub(/HASHMAP/, "ORDERED_HASHMAP"); \ + gsub(/Hashmap/, "OrderedHashmap"); \ + print }' <$< >$@ + +nodist_test_hashmap_SOURCES = \ + src/test/test-hashmap-ordered.c + test_hashmap_SOURCES = \ - src/test/test-hashmap.c + src/test/test-hashmap.c \ + src/test/test-hashmap-plain.c test_hashmap_LDADD = \ libsystemd-core.la -- cgit v1.2.3