static void init_base_types(void) { base[0] = bool_type(&types); // bool base[1] = bv_type(&types, 5); // bv5 base[2] = new_scalar_type(&types, 3); // scalar3 base[3] = new_scalar_type(&types, 1); // scalar1 base[4] = pair_type(base[0], base[2]); // bool x scalar3 base[5] = pair_type(base[3], base[0]); // scalar1 x bool base[6] = fun_type1(base[0], base[2]); // [bool -> scalar3] base[7] = fun_type1(base[0], base[3]); // [bool -> scalar1] base[8] = fun_type1(base[2], base[0]); // [scalar3 -> bool] base[9] = fun_type1(base[3], base[0]); // [scalar1 -> bool] base[10] = fun_type1(base[0], base[0]); // [bool -> bool] base[11] = fun_type1(base[10], base[0]); // [[bool -> bool] -> bool] // some infinite types base[12] = new_uninterpreted_type(&types); base[13] = real_type(&types); base[14] = int_type(&types); base[15] = fun_type1(base[14], base[0]); // [int -> bool] base[16] = fun_type2(base[0], base[0], base[14]); // [bool, bool -> int] // larger finite types base[17] = pair_type(base[1], base[1]); // bv5 x bv5 base[18] = bv_type(&types, 40); // bv40 // infinite domain, unit range base[19] = fun_type1(base[13], base[3]); // [real -> scalar1] }
static void init_base_types(void) { base[0] = bool_type(&types); // bool base[1] = bv_type(&types, 5); // bv5 base[2] = new_scalar_type(&types, 3); // scalar3 base[3] = new_scalar_type(&types, 1); // scalar1 base[4] = pair_type(base[0], base[2]); // bool x scalar3 base[5] = pair_type(base[3], base[0]); // scalar1 x bool base[6] = fun_type1(base[0], base[2]); // [bool -> scalar3] base[7] = fun_type1(base[0], base[3]); // [bool -> scalar1] base[8] = fun_type1(base[2], base[0]); // [scalar3 -> bool] base[9] = fun_type1(base[3], base[0]); // [scalar1 -> bool] }
/* * Test1: elements of a scalar type */ static void test1(void) { type_t tau; particle_t a, b, c; particle_t q[40], x; uint32_t n; printf("\n" "***********************\n" "* TEST 1 *\n" "***********************\n"); tau = new_scalar_type(&types, 8); a = pstore_labeled_particle(&store, 32, tau); b = pstore_labeled_particle(&store, 34, tau); c = pstore_fresh_particle(&store, tau); printf("\nInitial objects of type tau!%"PRId32"\n", tau); print_particle_def(a); print_particle_def(b); print_particle_def(c); printf("\n"); // array a, c q[0] = a; q[1] = c; printf("Test array: "); print_particle_array(q, 2); printf("\n"); // create new objects until that fails n = 2; x = get_distinct_particle(&store, tau, n, q); while (x != null_particle) { printf("New particle:"); print_particle_def(x); q[n] = x; n ++; assert(n <= 40); x = get_distinct_particle(&store, tau, n, q); } printf("\nSaturation\n"); print_particle_set(pstore_find_set_for_type(&store, tau)); printf("\n\n"); }
/* * Test 4: pairs (scalar6 x bool) * - start with scalar6 empty * - if test3 is called first, bool is saturated */ static void test4(void) { type_t tau[2]; particle_t q[40], x; uint32_t n; printf("\n" "***********************\n" "* TEST 4 *\n" "***********************\n"); tau[0] = new_scalar_type(&types, 6); tau[1] = bool_type(&types); // Initial array: empty printf("Test array: "); print_particle_array(q, 0); printf("\n"); // create new tuples until that fails for (n = 0; n<40; n++) { x = get_distinct_tuple(&store, 2, tau, n, q); if (x == null_particle) { printf("Saturation\n"); break; } printf("New particle:"); print_particle_def(x); q[n] = x; } printf("\nFinal sets\n"); print_particle_set(pstore_find_set_for_type(&store, tau[0])); printf("\n"); print_particle_set(pstore_find_set_for_type(&store, tau[1])); printf("\n"); print_particle_set(pstore_find_set_for_types(&store, 2, tau)); printf("\n\n"); }