diff options
| -rw-r--r-- | config.mk | 1 | ||||
| -rw-r--r-- | csv-test.c | 36 | ||||
| -rw-r--r-- | makefile | 2 |
3 files changed, 20 insertions, 19 deletions
| @@ -1,2 +1,3 @@ | |||
| 1 | CC=cc | 1 | CC=cc |
| 2 | CFLAGS=-Wall -Wextra -pedantic -std=c99 -O2 | 2 | CFLAGS=-Wall -Wextra -pedantic -std=c99 -O2 |
| 3 | CFLAGS-TEST=$(CFLAGS) -fprofile-instr-generate -fcoverage-mapping | ||
| @@ -17,7 +17,7 @@ | |||
| 17 | f = NULL | 17 | f = NULL |
| 18 | 18 | ||
| 19 | void | 19 | void |
| 20 | test1(void) | 20 | test_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 | ||
| 47 | void | 47 | void |
| 48 | test2(void) | 48 | test_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 | ||
| 75 | void | 75 | void |
| 76 | test3(void) | 76 | test_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 | ||
| 224 | void | 224 | void |
| 225 | test4(void) | 225 | test_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 | ||
| 373 | void | 373 | void |
| 374 | test5(void) | 374 | test_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 | ||
| 396 | void | 396 | void |
| 397 | test6(void) | 397 | test_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 | ||
| 421 | void | 421 | void |
| 422 | error1(void) | 422 | test_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 | ||
| 457 | void | 457 | void |
| 458 | error2(void) | 458 | test_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 | ||
| 528 | void | 528 | void |
| 529 | memory_fail1(void) | 529 | test_allocation_error1(void) |
| 530 | { | 530 | { |
| 531 | jmp_buf env; | 531 | jmp_buf env; |
| 532 | 532 | ||
| @@ -566,17 +566,17 @@ memory_fail1(void) | |||
| 566 | int | 566 | int |
| 567 | main(void) | 567 | main(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 | } |
| @@ -3,7 +3,7 @@ include config.mk | |||
| 3 | all: csv-test csv-perf seq-read | 3 | all: csv-test csv-perf seq-read |
| 4 | 4 | ||
| 5 | csv-test: csv-test.c csv.c csv.h | 5 | csv-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 | ||
| 9 | coverage: csv-test | 9 | coverage: csv-test |
