From 319e60d31b30c59868edc0bee8688ba4f40fdb80 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Wed, 1 Jul 2020 16:37:30 +0200 Subject: Testfälle besser dokumentiert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.mk | 1 + csv-test.c | 36 ++++++++++++++++++------------------ makefile | 2 +- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/config.mk b/config.mk index 3324e89..4adb96e 100644 --- a/config.mk +++ b/config.mk @@ -1,2 +1,3 @@ CC=cc CFLAGS=-Wall -Wextra -pedantic -std=c99 -O2 +CFLAGS-TEST=$(CFLAGS) -fprofile-instr-generate -fcoverage-mapping diff --git a/csv-test.c b/csv-test.c index 99325af..c5152ea 100644 --- a/csv-test.c +++ b/csv-test.c @@ -17,7 +17,7 @@ f = NULL void -test1(void) +test_line_endings1(void) { FILE *f; csv_t csv = { 0 }; @@ -45,7 +45,7 @@ test1(void) } void -test2(void) +test_line_endings2(void) { FILE *f; csv_t csv = { 0 }; @@ -73,7 +73,7 @@ test2(void) } void -test3(void) +test_empty_fields(void) { FILE *f; csv_t csv = { 0 }; @@ -222,7 +222,7 @@ test3(void) } void -test4(void) +test_simple_fields(void) { FILE *f; csv_t csv = { 0 }; @@ -371,7 +371,7 @@ test4(void) } void -test5(void) +test_quoted_fields(void) { FILE *f; csv_t csv = { 0 }; @@ -394,7 +394,7 @@ test5(void) } void -test6(void) +test_wrong_quoted_field(void) { FILE *f; csv_t csv = { 0 }; @@ -419,7 +419,7 @@ cb_error(csv_err_t err, void *cb_arg) } void -error1(void) +test_out_of_range_error(void) { jmp_buf env; csv_options_t csv_options = csv_default_options; @@ -455,7 +455,7 @@ error1(void) } void -error2(void) +test_read_error(void) { jmp_buf env; csv_options_t csv_options = csv_default_options; @@ -526,7 +526,7 @@ my_free(void *ptr, size_t n, size_t sz, void *cb_arg) } void -memory_fail1(void) +test_allocation_error1(void) { jmp_buf env; @@ -566,17 +566,17 @@ memory_fail1(void) int main(void) { - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); + test_line_endings1(); + test_line_endings2(); + test_empty_fields(); + test_simple_fields(); + test_quoted_fields(); + test_wrong_quoted_field(); - error1(); - error2(); + test_out_of_range_error(); + test_read_error(); - memory_fail1(); + test_allocation_error1(); return EXIT_SUCCESS; } diff --git a/makefile b/makefile index acf3564..5866c43 100644 --- a/makefile +++ b/makefile @@ -3,7 +3,7 @@ include config.mk all: csv-test csv-perf seq-read csv-test: csv-test.c csv.c csv.h - $(CC) $(CFLAGS) -fprofile-instr-generate -fcoverage-mapping -DNDEBUG -o $@ csv-test.c csv.c + $(CC) $(CFLAGS-TEST) -DNDEBUG -o $@ csv-test.c csv.c ./$@ coverage: csv-test -- cgit v1.3