コード例 #1
0
int main() {
  uint32_t i;
  smt_logic_t code;

  for (i=0; i<NUM_SMT_LOGICS; i++) {
    printf("Testing '%s'\n", test_names[i]);
    code = smt_logic_code(test_names[i]);
    printf("code = %"PRId32": %s\n\n", (int32_t) code, code2string[code]);
    if (strcmp(test_names[i], code2string[code]) != 0) {
      printf("BUG: smt_logic_code didn't return the right code\n");
      exit(1);
    }
  }

  for (i=NUM_SMT_LOGICS; i<NUM_TESTS; i++) {
    printf("Testing '%s'\n", test_names[i]);
    code = smt_logic_code(test_names[i]);
    printf("code = %"PRId32": %s\n\n", (int32_t) code, code2string[code]);
    if (code != SMT_UNKNOWN) {
      printf("BUG: smt_logic_code didn't return SMT_UNKNOWN\n");
      exit(1);
    }
  }

  printf("All tests succeeded\n");
  fflush(stdout);

  return 0;
}
コード例 #2
0
/*
 * Set a default configuration to support the given logic
 * - return -1 if the logic name is not recognized
 * - return -2 if we don't support the logic yet
 * - return 0 otherwise
 *
 * If the function returns 0, the logic field is updated.
 * All other fields are left unchanged.
 */
int32_t config_set_logic(ctx_config_t *config, const char *logic) {
  smt_logic_t code;
  int32_t r;

  code = smt_logic_code(logic);
  if (code == SMT_UNKNOWN) {
    r = -1;
  } else if (logic2arch[code] < 0) {
    r = -2;
  } else {
    config->logic = (smt_logic_t) code;
    r = 0;
  }

  return r;
}