ocaml-containers/tests/data/t_zipper.ml
Simon Cruanes 10865eaced reformat
2022-07-04 13:36:06 -04:00

20 lines
629 B
OCaml

module Test = (val Containers_testlib.make ~__FILE__ ())
open Test
open CCZipper;;
t @@ fun () -> is_empty empty;;
t @@ fun () -> not ([ 42 ] |> make |> right |> is_empty)
let zip_gen = Q.(pair (small_list int) (small_list int));;
q zip_gen (fun z -> to_list z = List.rev (to_rev_list z));;
q zip_gen (fun g -> is_focused g = (focused g |> CCOption.is_some));;
q
Q.(triple int (list small_int) (list small_int))
(fun (x, l, r) -> insert x (l, r) |> remove = (l, r))
;;
eq ([ 1 ], [ 2 ]) (drop_after ([ 1 ], [ 2; 3 ]));;
eq ([ 1 ], []) (drop_after ([ 1 ], []));;
eq ([ 1 ], []) (drop_after_and_focused ([ 1 ], [ 2; 3 ]))