diff options
| author | Thomas Schmucker <ts@its1.de> | 2020-06-19 10:28:02 +0200 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2020-06-19 10:28:02 +0200 |
| commit | 878793e5f1952a7e208689264bade2c1a5e0a29d (patch) | |
| tree | d3a05142abd099cd24e242ea302b27f5bac4c438 /csv-test.c | |
| parent | f2d0abef408790c1c46d8c51951e3092c9e1edde (diff) | |
| download | libcsv-878793e5f1952a7e208689264bade2c1a5e0a29d.tar.gz libcsv-878793e5f1952a7e208689264bade2c1a5e0a29d.tar.bz2 libcsv-878793e5f1952a7e208689264bade2c1a5e0a29d.zip | |
Beispiel für einen normalen Ablauf ohne Exceptions hinzugefügt.
Diffstat (limited to 'csv-test.c')
| -rw-r--r-- | csv-test.c | 18 |
1 files changed, 17 insertions, 1 deletions
| @@ -7,6 +7,21 @@ | |||
| 7 | #include "csv.h" | 7 | #include "csv.h" |
| 8 | 8 | ||
| 9 | static int | 9 | static int |
| 10 | test(FILE *f) | ||
| 11 | { | ||
| 12 | int line = 0; | ||
| 13 | csv_t csv[1]; | ||
| 14 | |||
| 15 | csv_init(csv); | ||
| 16 | for ( int n; (n = csv_read(csv, f)) != -1; ) { | ||
| 17 | ++line; | ||
| 18 | } | ||
| 19 | csv_free(csv); | ||
| 20 | |||
| 21 | return line; | ||
| 22 | } | ||
| 23 | |||
| 24 | static int | ||
| 10 | test_exception(FILE *f) | 25 | test_exception(FILE *f) |
| 11 | { | 26 | { |
| 12 | int line = 0; | 27 | int line = 0; |
| @@ -98,9 +113,10 @@ main(void) | |||
| 98 | 113 | ||
| 99 | clock_t start = clock(); | 114 | clock_t start = clock(); |
| 100 | 115 | ||
| 116 | int lines = test(in); | ||
| 101 | (void) test_exception; | 117 | (void) test_exception; |
| 102 | (void) test_exception_with_signal; | 118 | (void) test_exception_with_signal; |
| 103 | int lines = test_exception_longjmp(in); | 119 | (void) test_exception_longjmp; |
| 104 | 120 | ||
| 105 | clock_t end = clock(); | 121 | clock_t end = clock(); |
| 106 | 122 | ||
