From f8d247c53c3c3bd94fed645b5b47a9096cadc123 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 10 Oct 2024 14:30:39 +0200 Subject: Removed "options" from solver selection Now the solver name fully determines the solver (and options) to be used. For example, now one must specify "h48h0k4" as the name of the solver. This PR also fixes a couple of things in tools. --- tools/000_gendata/gendata.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'tools/000_gendata') diff --git a/tools/000_gendata/gendata.c b/tools/000_gendata/gendata.c index 2798862..eec9f76 100644 --- a/tools/000_gendata/gendata.c +++ b/tools/000_gendata/gendata.c @@ -1,16 +1,16 @@ #include "../tool.h" #include "../expected_distributions.h" -char *solver, *options; +char *solver; uint64_t *expected; static void run(void) { int64_t size; + bool consistent, expected; char *buf, filename[1024]; - getfilename(solver, options, filename); - size = generatetable(solver, options, &buf); + size = generatetable(solver, &buf); switch (size) { case -1: return; @@ -18,11 +18,19 @@ run(void) { goto gendata_run_finish; default: nissy_datainfo(buf, write_stdout); - if (check_distribution(solver, buf)) { + consistent = nissy_checkdata(solver, buf) == 0; + expected = check_distribution(solver, buf); + if (consistent && expected) { printf("\n"); printf("Generated %" PRId64 " bytes.\n", size); + sprintf(filename, "tables/%s", solver); writetable(buf, size, filename); } + if (!consistent) + printf("Error: table is not consistent with info" + " (nissy_checkdata() failed)\n"); + if (!expected) + printf("Error: distribution is not as expected\n"); break; } @@ -33,15 +41,14 @@ gendata_run_finish: int main(int argc, char **argv) { uint8_t h, k; - if (argc < 3) { + if (argc < 2) { fprintf(stderr, "Error: not enough arguments. " - "A solver and its options must be given.\n"); + "A solver must be given.\n"); return 1; } solver = argv[1]; - options = argv[2]; - parse_h48_options(options, &h, &k, NULL); + parse_h48_solver(solver, &h, &k); expected = expected_h48[h][k]; nissy_setlogger(log_stderr); -- cgit v1.3