aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2020-07-01 16:37:30 +0200
committerThomas Schmucker <ts@its1.de>2020-07-01 16:37:30 +0200
commit319e60d31b30c59868edc0bee8688ba4f40fdb80 (patch)
tree2802d21a7bbba1dba8d30bef9df576395f0abd8d
parent92ed56e6368b1685fbfbd23fda17fe95a109dd51 (diff)
downloadlibcsv-319e60d31b30c59868edc0bee8688ba4f40fdb80.tar.gz
libcsv-319e60d31b30c59868edc0bee8688ba4f40fdb80.tar.bz2
libcsv-319e60d31b30c59868edc0bee8688ba4f40fdb80.zip
Testfälle besser dokumentiert
-rw-r--r--config.mk1
-rw-r--r--csv-test.c36
-rw-r--r--makefile2
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 @@
1CC=cc 1CC=cc
2CFLAGS=-Wall -Wextra -pedantic -std=c99 -O2 2CFLAGS=-Wall -Wextra -pedantic -std=c99 -O2
3CFLAGS-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 @@
17 f = NULL 17 f = NULL
18 18
19void 19void
20test1(void) 20test_line_endings1(void)
21{ 21{
22 FILE *f; 22 FILE *f;
23 csv_t csv = { 0 }; 23 csv_t csv = { 0 };
@@ -45,7 +45,7 @@ test1(void)
45} 45}
46 46
47void 47void
48test2(void) 48test_line_endings2(void)
49{ 49{
50 FILE *f; 50 FILE *f;
51 csv_t csv = { 0 }; 51 csv_t csv = { 0 };
@@ -73,7 +73,7 @@ test2(void)
73} 73}
74 74
75void 75void
76test3(void) 76test_empty_fields(void)
77{ 77{
78 FILE *f; 78 FILE *f;
79 csv_t csv = { 0 }; 79 csv_t csv = { 0 };
@@ -222,7 +222,7 @@ test3(void)
222} 222}
223 223
224void 224void
225test4(void) 225test_simple_fields(void)
226{ 226{
227 FILE *f; 227 FILE *f;
228 csv_t csv = { 0 }; 228 csv_t csv = { 0 };
@@ -371,7 +371,7 @@ test4(void)
371} 371}
372 372
373void 373void
374test5(void) 374test_quoted_fields(void)
375{ 375{
376 FILE *f; 376 FILE *f;
377 csv_t csv = { 0 }; 377 csv_t csv = { 0 };
@@ -394,7 +394,7 @@ test5(void)
394} 394}
395 395
396void 396void
397test6(void) 397test_wrong_quoted_field(void)
398{ 398{
399 FILE *f; 399 FILE *f;
400 csv_t csv = { 0 }; 400 csv_t csv = { 0 };
@@ -419,7 +419,7 @@ cb_error(csv_err_t err, void *cb_arg)
419} 419}
420 420
421void 421void
422error1(void) 422test_out_of_range_error(void)
423{ 423{
424 jmp_buf env; 424 jmp_buf env;
425 csv_options_t csv_options = csv_default_options; 425 csv_options_t csv_options = csv_default_options;
@@ -455,7 +455,7 @@ error1(void)
455} 455}
456 456
457void 457void
458error2(void) 458test_read_error(void)
459{ 459{
460 jmp_buf env; 460 jmp_buf env;
461 csv_options_t csv_options = csv_default_options; 461 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)
526} 526}
527 527
528void 528void
529memory_fail1(void) 529test_allocation_error1(void)
530{ 530{
531 jmp_buf env; 531 jmp_buf env;
532 532
@@ -566,17 +566,17 @@ memory_fail1(void)
566int 566int
567main(void) 567main(void)
568{ 568{
569 test1(); 569 test_line_endings1();
570 test2(); 570 test_line_endings2();
571 test3(); 571 test_empty_fields();
572 test4(); 572 test_simple_fields();
573 test5(); 573 test_quoted_fields();
574 test6(); 574 test_wrong_quoted_field();
575 575
576 error1(); 576 test_out_of_range_error();
577 error2(); 577 test_read_error();
578 578
579 memory_fail1(); 579 test_allocation_error1();
580 580
581 return EXIT_SUCCESS; 581 return EXIT_SUCCESS;
582} 582}
diff --git a/makefile b/makefile
index acf3564..5866c43 100644
--- a/makefile
+++ b/makefile
@@ -3,7 +3,7 @@ include config.mk
3all: csv-test csv-perf seq-read 3all: csv-test csv-perf seq-read
4 4
5csv-test: csv-test.c csv.c csv.h 5csv-test: csv-test.c csv.c csv.h
6 $(CC) $(CFLAGS) -fprofile-instr-generate -fcoverage-mapping -DNDEBUG -o $@ csv-test.c csv.c 6 $(CC) $(CFLAGS-TEST) -DNDEBUG -o $@ csv-test.c csv.c
7 ./$@ 7 ./$@
8 8
9coverage: csv-test 9coverage: csv-test