/* * Test 2: build distinct terms */ static void test2(void) { uint32_t i; eterm_t aux; occ_t a[50]; literal_t l; type_t tau; printf("***********************\n" "* TEST 2 *\n" "***********************\n\n"); init_solver(&egraph, &core); tau = yices_new_uninterpreted_type(); printf("---> building a_0 ... a_49\n"); for (i=0; i<50; i++) { aux = egraph_make_variable(&egraph, tau); a[i] = pos_occ(aux); } for (i=0; i<40; i++) { printf("---> creating (distinct a_%"PRIu32" ... a_%"PRIu32")\n", i, i+5); l = egraph_make_distinct(&egraph, 5, a+i); printf("---> result = "); print_literal(stdout, l); printf("\n"); } print_solver(&egraph, &core); delete_solver(&egraph, &core); }
Solver_Interface::~Solver_Interface() { if ( _s ) delete_solver(_s); if (_handle) dlclose(_handle); }
/* * Test 1: construct simple terms, push/pop */ static void test1(void) { eterm_t tx, ty; occ_t x, y; type_t u; printf("***********************\n" "* TEST 1 *\n" "***********************\n\n"); init_solver(&egraph, &core); u = yices_new_uninterpreted_type(); // create x and y printf("---> building x and y\n"); tx = egraph_make_variable(&egraph, u); x = pos_occ(tx); ty = egraph_make_variable(&egraph, u); y = pos_occ(ty); // test push/pop printf("---> push\n"); smt_push(&core); // create (eq x y) printf("---> building (eq x y)\n"); (void) egraph_make_eq(&egraph, x, y); // create (eq y y) printf("---> building (eq x x)\n"); (void) egraph_make_eq(&egraph, y, y); print_solver(&egraph, &core); // empty push printf("---> push\n"); smt_push(&core); // start search + propagate + end_search printf("---> propagation test 1\n"); start_search(&core); smt_process(&core); end_search_unknown(&core); print_solver(&egraph, &core); printf("---> pop 1\n"); smt_pop(&core); print_solver(&egraph, &core); // start search + propagate + end_search printf("---> propagation test 2\n"); start_search(&core); smt_process(&core); end_search_unknown(&core); print_solver(&egraph, &core); printf("---> pop 2\n"); smt_pop(&core); print_solver(&egraph, &core); // reset reset_solver(&egraph, &core); print_solver(&egraph, &core); delete_solver(&egraph, &core); }