expr_info_mapreduce_test.ml 458 Bytes
Newer Older
POTTIER Francois's avatar
POTTIER Francois committed
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
open Expr_info_mapreduce
open Expr_info_mapreduce_use

let mk node = { info = (); node }

let const i =
  mk (EConst i)

let add e1 e2 =
  mk (EAdd (e1, e2))

let e =
  add (const 1) (add (const 0) (const 3))

let (e : int expr) =
  annotate e

let () =
  assert (e.info = 5);
  begin match e.node with
  | EAdd (e1, e2) ->
     assert (e1.info = 1);
     assert (e2.info = 3);
     ()
  | EConst _ ->
     assert false
  end;
  Printf.printf "OK\n%!";
  ()