Commit e59ae0d1 authored by Julien Lopez's avatar Julien Lopez
Browse files

[TESTS][LAMBDA][MINOR] printer for Subst value; add sigmas in tests

parent ebbdd252
......@@ -141,20 +141,20 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
assert_equal ~msg:"Test CDuce.runtime.misc.map_is_int_simple failed"
~printer:(fun x -> x)
"(Atom(false), Atom(true), {})"
(run_test_eval "(fun map f : ('A{}->'B{}) x : ['A{}] : ['B{}] ->
match x : ['A{}] with
| (el : 'A{}) :: (rest : ['A{}]) -> [f.el; (map.f).rest]
| el : ['A{}] -> f.el).(fun ((Int -> Bool) & (Bool -> Bool) & ((!(Int|Bool)) -> (!(Int|Bool))))
(run_test_eval "(fun map f : ('A{A/Int;A/Bool}->'B{A/Int;A/Bool}) x : ['A{A/Int;A/Bool}] : ['B{A/Int;A/Bool}] ->
match x : ['A{A/Int;A/Bool}] with
| (el : 'A{A/Int;A/Bool}) :: (rest : ['A{A/Int;A/Bool}]) -> [f.el; (map.f).rest]
| el : ['A{A/Int;A/Bool}] -> f.el).(fun ((Int -> Bool) & (Bool -> Bool) & ((!(Int|Bool)) -> (!(Int|Bool))))
| x : Int -> `true
| x : Bool -> `false
| x : (!(Int|Bool)) -> x).[`true; 3]");
assert_equal ~msg:"Test CDuce.runtime.misc.map_is_int_medium failed"
~printer:(fun x -> x)
"(Atom(false), Atom(true), Atom(false), {})"
(run_test_eval "(fun map f : ('A{}->'B{}) x : ['A{}] : ['B{}] ->
match x : ['A{}] with
| (el : 'A{}) :: (rest : ['A{}]) -> [f.el; (map.f).rest]
| el : ['A{}] -> f.el).(fun ((Int -> Bool) & (Bool -> Bool) & ((!(Int|Bool)) -> (!(Int|Bool))))
(run_test_eval "(fun map f : ('A{A/Int;A/Bool}->'B{A/Int;A/Bool}) x : ['A{A/Int;A/Bool}] : ['B{A/Int;A/Bool}] ->
match x : ['A{A/Int;A/Bool}] with
| (el : 'A{A/Int;A/Bool}) :: (rest : ['A{A/Int;A/Bool}]) -> [f.el; (map.f).rest]
| el : ['A{A/Int;A/Bool}] -> f.el).(fun ((Int -> Bool) & (Bool -> Bool) & ((!(Int|Bool)) -> (!(Int|Bool))))
| x : Int -> `true
| x : Bool -> `false
| x : (!(Int|Bool)) -> x).[`true; 3; `true]");
......
......@@ -25,6 +25,14 @@ let rec pp_typed ppf e =
Types.Print.print e.Typed.exp_typ
pp_typed_aux e
and pp_typedsigma ppf =
let rec aux ppf = function
| (v, t) :: rest -> Format.fprintf ppf "(%a, %a)" Var.dump v Types.Print.print t
| [] -> Format.fprintf ppf "" in
function
| s :: rest -> Format.fprintf ppf "[%a, %a]" aux s pp_typedsigma rest
| [] -> Format.fprintf ppf ""
and pp_typed_aux ppf e =
match e.Typed.exp_descr with
| Typed.Forget(e, _) -> Format.fprintf ppf "Forget(%a)" pp_typed e
......@@ -52,6 +60,8 @@ and pp_typed_aux ppf e =
Format.fprintf ppf "\"%s\"" (Encodings.Utf8.to_string s)
| Typed.Match(e, b) ->
Format.fprintf ppf "Match(%a,%a)" pp_typed e pp_branches b
| Typed.Subst(e, s) ->
Format.fprintf ppf "Subst(%a,[%a])" pp_typed e pp_typedsigma s
| _ -> assert false
and pp_abst ppf abstr =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment