Added more samples for coverage

This commit is contained in:
Snaipe 2015-04-12 16:38:14 +02:00
parent a5922bc377
commit f43a179b79
4 changed files with 23 additions and 2 deletions

View file

@ -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 \

View file

@ -1,10 +1,12 @@
#include <criterion/criterion.h>
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);

14
samples/other-crashes.c Normal file
View file

@ -0,0 +1,14 @@
#include <criterion/criterion.h>
void crash(void) {
int *i = NULL;
*i = 42;
}
Test(misc, setup_crash, .init = crash) {
assert(true);
}
Test(misc, teardown_crash, .fini = crash) {
assert(true);
}

1
samples/with-time.c Symbolic link
View file

@ -0,0 +1 @@
simple.c