From f43a179b79c62aebf0a10773afcb581cfaa86e08 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Sun, 12 Apr 2015 16:38:14 +0200 Subject: [PATCH] Added more samples for coverage --- samples/Makefile.am | 4 ++++ samples/more-suites.c | 6 ++++-- samples/other-crashes.c | 14 ++++++++++++++ samples/with-time.c | 1 + 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 samples/other-crashes.c create mode 120000 samples/with-time.c diff --git a/samples/Makefile.am b/samples/Makefile.am index 78d071a..a1d7231 100644 --- a/samples/Makefile.am +++ b/samples/Makefile.am @@ -7,6 +7,8 @@ BIN_TESTS = \ more-suites \ long-messages \ description \ + other-crashes \ + with-time \ simple TESTS_ENVIRONMENT = CRITERION_ALWAYS_SUCCEED=1 @@ -15,6 +17,8 @@ check_PROGRAMS := $(BIN_TESTS) CFLAGS = -I$(top_srcdir)/include/ -std=c99 -Wall -Wextra -pedantic LDADD = -L$(top_srcdir)/ -lcriterion +with_time_LDADD = $(LDADD) -lrt + SCRIPT_TESTS = tests/tap_test.sh \ tests/early_exit.sh \ tests/verbose.sh \ diff --git a/samples/more-suites.c b/samples/more-suites.c index 701866a..1b2f14e 100644 --- a/samples/more-suites.c +++ b/samples/more-suites.c @@ -1,10 +1,12 @@ #include void setup_suite(void) { - // setup suite } -TestSuite(suite1, .init = setup_suite); +void teardown_suite(void) { +} + +TestSuite(suite1, .init = setup_suite, .fini = teardown_suite); Test(suite1, test) { assert(1); diff --git a/samples/other-crashes.c b/samples/other-crashes.c new file mode 100644 index 0000000..a1baa27 --- /dev/null +++ b/samples/other-crashes.c @@ -0,0 +1,14 @@ +#include + +void crash(void) { + int *i = NULL; + *i = 42; +} + +Test(misc, setup_crash, .init = crash) { + assert(true); +} + +Test(misc, teardown_crash, .fini = crash) { + assert(true); +} diff --git a/samples/with-time.c b/samples/with-time.c new file mode 120000 index 0000000..9ef1a34 --- /dev/null +++ b/samples/with-time.c @@ -0,0 +1 @@ +simple.c \ No newline at end of file