tallyingTest.ml 628 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
open OUnit

(* open Types *)

let parse_typ s =
  let st = Stream.of_string s in
  let astpat = Parser.pat st in 
  let nodepat = Typer.typ Builtin.env astpat in
  Types.descr nodepat
;;

let norm_tests = [
  "Int \\ (`$A | `$B)", [[(false,`Var "A",parse_typ "Int \\ `$B")]];
]

let test_norm =
  "test tallying norm" >:::
    List.map (fun (t,expected) ->
      (Printf.sprintf " %s " t) >:: (fun _ ->
        let ll = Types.Tallying.norm (parse_typ t) in
        assert_equal ll expected
      )
    ) norm_tests
;;

let all =
  "all tests" >::: [
    test_norm;
  ]
 
let main () =
  OUnit.run_test_tt_main all
;;
 
main ()