Пример #1
0
int main(void) {
    type_t tau;

    init_type_table(&types, 0);
    init_variables();
    init_types();

    // pair(A) = (tuple A A)
    tau = pair_type(var[0], var[0]);
    test_macro("pair", 1, var, tau);

    // triple(B) = (tuple B B B)
    tau = triple_type(var[1], var[1], var[1]);
    test_macro("triple", 1, var+1, tau);

    // test(C, D) = bool
    test_macro("test", 2, var+2, base[0]);

    // fun(E, F) = (-> (tuple E E) F)
    tau = pair_type(var[4], var[4]);
    tau = function_type(&types, var[5], 1, &tau);
    test_macro("fun", 2, var+4, tau);

    // two constructors
    test_constructor("mk_type2", 2);
    test_constructor("mk_type3", 3);

    printf("\n====== TYPES ========\n");
    print_type_table(stdout, &types);
    printf("\n===== MACROS ========\n");
    print_type_macros(stdout, &types);
    printf("===\n\n");

    // creation after remove
    // vector[G] = (-> int G)
    tau = int_type(&types);
    tau = function_type(&types, var[6], 1, &tau);
    test_macro("vector", 1, var+6, tau);

    // matrix[H] = (-> int int H)
    tau = int_type(&types);
    tau = binary_ftype(tau, tau, var[7]);
    test_macro("matrix", 1, var+7, tau);

    printf("\n====== TYPES ========\n");
    print_type_table(stdout, &types);
    printf("\n===== MACROS ========\n");
    print_type_macros(stdout, &types);
    printf("===\n\n");

    delete_type_table(&types);

    return 0;
}
Пример #2
0
int main(void) {
  init_type_table(&types, 10);
  init_value_table(&vtbl, 0, &types);
  init_fresh_val_maker(&maker, &vtbl);

  init_base_types();

  test_base_types();

  delete_fresh_val_maker(&maker);
  delete_value_table(&vtbl);
  delete_type_table(&types);

  return 0;
}
Пример #3
0
int main() {
  init_type_table(&types, 10);
  init_pstore(&store, &types);

  test1();
  test2();
  test3();
  test4();
  test5();
  test6();

  delete_pstore(&store);
  delete_type_table(&types);

  return 0;
}
Пример #4
0
int main(void) {
  init_type_table(&types, 10);
  init_value_table(&vtbl, 0, &types);

  init_base_types();
  test_base_types();
  test_pairs(1000);
  test_triples(1000);
  test_unary_functions(1000);
  test_bin_functions(1000);
  test_deep_type();

  delete_value_table(&vtbl);
  delete_type_table(&types);

  return 0;
}