diff options
Diffstat (limited to 'tools/100_checkdata/checkdata.c')
| -rw-r--r-- | tools/100_checkdata/checkdata.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tools/100_checkdata/checkdata.c b/tools/100_checkdata/checkdata.c index 502925f..695a4dd 100644 --- a/tools/100_checkdata/checkdata.c +++ b/tools/100_checkdata/checkdata.c | |||
| @@ -1,15 +1,15 @@ | |||
| 1 | #include "../tool.h" | 1 | #include "../tool.h" |
| 2 | #include "../expected_distributions.h" | 2 | #include "../expected_distributions.h" |
| 3 | 3 | ||
| 4 | char *solver, *options, *filename; | 4 | char *solver, *filename; |
| 5 | 5 | ||
| 6 | static void | 6 | static void |
| 7 | run(void) { | 7 | run(void) { |
| 8 | int64_t size; | 8 | int64_t size, result; |
| 9 | char *buf; | 9 | char *buf; |
| 10 | FILE *f; | 10 | FILE *f; |
| 11 | 11 | ||
| 12 | size = nissy_datasize(solver, options); | 12 | size = nissy_datasize(solver); |
| 13 | 13 | ||
| 14 | if (size <= 0) { | 14 | if (size <= 0) { |
| 15 | fprintf(stderr, "Error in datasize\n"); | 15 | fprintf(stderr, "Error in datasize\n"); |
| @@ -24,22 +24,23 @@ run(void) { | |||
| 24 | buf = malloc(size); | 24 | buf = malloc(size); |
| 25 | fread(buf, size, 1, f); | 25 | fread(buf, size, 1, f); |
| 26 | fclose(f); | 26 | fclose(f); |
| 27 | nissy_checkdata(solver, options, buf); | 27 | result = nissy_checkdata(solver, buf); |
| 28 | free(buf); | 28 | free(buf); |
| 29 | 29 | ||
| 30 | printf("checkdata %s\n", result == 0 ? "succeeded" : "failed"); | ||
| 31 | |||
| 30 | /* TODO: cross-check with expected distributions? */ | 32 | /* TODO: cross-check with expected distributions? */ |
| 31 | } | 33 | } |
| 32 | 34 | ||
| 33 | int main(int argc, char **argv) { | 35 | int main(int argc, char **argv) { |
| 34 | if (argc < 4) { | 36 | if (argc < 3) { |
| 35 | fprintf(stderr, "Error: not enough arguments. " | 37 | fprintf(stderr, "Error: not enough arguments. " |
| 36 | "A solver, its options and a file name must be given.\n"); | 38 | "A solver and a file name must be given.\n"); |
| 37 | return 1; | 39 | return 1; |
| 38 | } | 40 | } |
| 39 | 41 | ||
| 40 | solver = argv[1]; | 42 | solver = argv[1]; |
| 41 | options = argv[2]; | 43 | filename = argv[2]; |
| 42 | filename = argv[3]; | ||
| 43 | nissy_setlogger(log_stderr); | 44 | nissy_setlogger(log_stderr); |
| 44 | 45 | ||
| 45 | timerun(run); | 46 | timerun(run); |
