コード例 #1
0
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]
}
コード例 #2
0
/*
 * TEST 5: binary functions
 */
static void test_bin_functions(uint32_t threshold) {
  uint32_t i, j, k;
  type_t tau;

  printf("****************************\n"
	 "*   BINARY FUNCTION TYPES  *\n"
	 "****************************\n"
	 "\n");

  for (i=0; i<NUM_BASE_TYPES; i++) {
    for (j=0; j<NUM_BASE_TYPES; j++) {
      for (k=0; k<NUM_BASE_TYPES; k++) {
	tau = fun_type2(base[i], base[j], base[k]);
	if (type_card(&types, tau) < threshold) {
	  test_enum_type(tau);
	}
      }
    }
  }
}