File: testsolve.c

package info (click to toggle)
kissat 4.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,068 kB
  • sloc: ansic: 39,201; sh: 1,226; makefile: 91
file content (58 lines) | stat: -rw-r--r-- 1,521 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "../src/file.h"

#include "test.h"
#include "testcnfs.h"

static unsigned scheduled;

static void schedule_solve_job_with_option (int expected, const char *opt,
                                            const char *path) {
  if (!kissat_file_readable (path)) {
    tissat_warning ("Skipping unreadable '%s'", path);
    return;
  }
  size_t len = strlen (opt) + strlen (path) + 1;
  char *cmd = malloc (len);
  strcpy (cmd, opt);
  strcat (cmd, path);
  tissat_schedule_application (expected, cmd);
  free (cmd);
  scheduled++;
}

static const char *simps[] = {
    "",
#ifndef NOPTIONS
    "--eliminateinit=0 ",
    "--probeinit=0 ",
    "--reduceinit=10 --rephaseinit=10 --rephaseint=10 ",
    "--incremental ",
    "--walkinitially ",
#endif
};

static const char **end_of_simps = simps + sizeof (simps) / sizeof *simps;

static void schedule_solve_job (int expected, const char *path) {
  for (const char **p = simps; p != end_of_simps; p++) {
    char combined[128];
    if (tissat_big) {
      for (all_tissat_options (opt)) {
        sprintf (combined, *p, opt);
        schedule_solve_job_with_option (expected, combined, path);
      }
    } else {
      const char *opt = tissat_next_option (scheduled);
      sprintf (combined, *p, opt);
      schedule_solve_job_with_option (expected, combined, path);
    }
  }
}

void tissat_schedule_solve (void) {
#define CNF(EXPECTED, NAME, BIG) \
  if (!BIG || tissat_big) \
    schedule_solve_job (EXPECTED, "../test/cnf/" #NAME ".cnf");
  CNFS
#undef CNF
}