Exemplo n.º 1
0
/*
 * Test of set_param:
 * - name = test parameter name
 * - value = test value
 * - k = expected returned value
 * - error = expected error code (if k < 0)
 */
static void test_set_param(param_t *params, const char *name, const char *value, int32_t k, int32_t error) {
  int32_t code;
  error_code_t ecode;

  printf("Testing set_param %s := %s: ", name, value);
  fflush(stdout);
  code = yices_set_param(params, name, value);
  if (code >= 0) {
    printf("ok\n");
    show_params(params);
  } else {
    printf("error\n");
    yices_print_error(stdout);
  }

  if (code != k) {
    printf("TEST FAILED\n");
    printf("--> Yices function returned %"PRId32"; %"PRId32" was expected\n", code, k);
    fflush(stdout);
    exit(1);
  } else if (k < 0) {
    ecode = yices_error_code();
    if (ecode != error) {
      printf("TEST FAILED\n");
      printf("--> Found error code %"PRId32"; %"PRId32" was expected\n", ecode, error);
      fflush(stdout);
      exit(1);
    }
  }

  printf("\n");
  fflush(stdout);
}
Exemplo n.º 2
0
CAMLprim value ocamlyices_params_set(value v_params, value v_name,
                                     value v_value) {
  CAMLparam3(v_params, v_name, v_value);
  param_t *params = Params_val(v_params);
  const char *name = String_val(v_name);
  const char *value_ = String_val(v_value);
  int32_t res;

  res = yices_set_param(params, name, value_);
  if (res != 0) {
    _oy_error();
  }

  CAMLreturn(Val_unit);
}