disjoint_interval_tree 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/c/Makefile ADDED
@@ -0,0 +1,58 @@
1
+ # Unit tests for the C disjoint interval tree.
2
+ #
3
+ # make build and run every configuration
4
+ # make debug build and run with assertions + paranoid coherency checks
5
+ # make sanitize build and run under address/undefined sanitizers
6
+ # make release build and run with -DNDEBUG -O3
7
+ # make valgrind run the debug build under valgrind
8
+ # make clean
9
+
10
+ CC ?= cc
11
+ SRCDIR = ../../ext/disjoint_interval_tree
12
+ WARNINGS = -Wall -Wextra -Wpedantic -Wshadow -Wcast-qual -Wwrite-strings \
13
+ -Wstrict-prototypes -Wmissing-prototypes -Wconversion -Wsign-conversion
14
+ CFLAGS += -std=gnu11 $(WARNINGS) -I$(SRCDIR)
15
+ LDFLAGS +=
16
+
17
+ SRC = $(SRCDIR)/dit.c test_dit.c
18
+ HEADERS = $(SRCDIR)/dit.h
19
+
20
+ SEED ?= 1
21
+
22
+ .PHONY: all debug sanitize release valgrind clean
23
+
24
+ all: debug sanitize release
25
+
26
+ # assertions on, plus a full coherency check after each mutation
27
+ debug: test_dit_debug
28
+ @echo "=== debug ==="
29
+ ./test_dit_debug $(SEED)
30
+
31
+ test_dit_debug: $(SRC) $(HEADERS)
32
+ $(CC) $(CFLAGS) -O0 -g3 -DDIT_PARANOID=1 -o $@ $(SRC) $(LDFLAGS)
33
+
34
+ # assertions on, sanitizers on
35
+ sanitize: test_dit_asan
36
+ @echo "=== sanitize ==="
37
+ ASAN_OPTIONS=detect_leaks=1 UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1 \
38
+ ./test_dit_asan $(SEED)
39
+
40
+ test_dit_asan: $(SRC) $(HEADERS)
41
+ $(CC) $(CFLAGS) -O1 -g3 -DDIT_PARANOID=1 \
42
+ -fsanitize=address,undefined -fno-omit-frame-pointer \
43
+ -o $@ $(SRC) $(LDFLAGS)
44
+
45
+ # what a user of the library actually compiles
46
+ release: test_dit_release
47
+ @echo "=== release ==="
48
+ ./test_dit_release $(SEED)
49
+
50
+ test_dit_release: $(SRC) $(HEADERS)
51
+ $(CC) $(CFLAGS) -O3 -DNDEBUG -o $@ $(SRC) $(LDFLAGS)
52
+
53
+ valgrind: test_dit_debug
54
+ valgrind --error-exitcode=1 --leak-check=full --track-origins=yes \
55
+ ./test_dit_debug $(SEED)
56
+
57
+ clean:
58
+ $(RM) test_dit_debug test_dit_asan test_dit_release