File: expr_info_mapreduce_test.ml

package info (click to toggle)
ocaml-visitors 20251114-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,944 kB
  • sloc: ml: 4,035; makefile: 42; sh: 18
file content (29 lines) | stat: -rw-r--r-- 458 bytes parent folder | download | duplicates (5)
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%!";
  ()