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] }
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] }
/* * TEST6: (-> (-> (-> bool bool) bool) bool) */ static void test_deep_type(void) { type_t b, tau; b = bool_type(&types); tau = fun_type1(b, b); // (-> bool bool) tau = fun_type1(tau, b); // (-> (-> bool bool) bool) tau = fun_type1(tau, b); // (-> (-> (-> bool bool) bool) bool) printf("*****************************\n" "* NESTED FUNCTION TYPE *\n" "*****************************\n" "\n"); test_enum_type(tau); }
/* * TEST4: unary functions */ static void test_unary_functions(uint32_t threshold) { uint32_t i, j; type_t tau; printf("***************************\n" "* UNARY FUNCTION TYPES *\n" "***************************\n" "\n"); for (i=0; i<NUM_BASE_TYPES; i++) { for (j=0; j<NUM_BASE_TYPES; j++) { tau = fun_type1(base[i], base[j]); if (type_card(&types, tau) < threshold) { test_enum_type(tau); } } } }