File: t_fun.ml

package info (click to toggle)
ocaml-containers 3.15%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,412 kB
  • sloc: ml: 33,221; sh: 122; makefile: 32
file content (23 lines) | stat: -rw-r--r-- 600 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[@@@ocaml.warning "-33"]

open CCFun
module T = (val Containers_testlib.make ~__FILE__ ())
include T;;

eq ~printer:Q.Print.int 10 (iterate 0 succ 10);;
eq ~printer:Q.Print.int 11 (iterate 1 succ 10);;
eq ~printer:Q.Print.int 12 (iterate 2 succ 10);;
eq ~printer:Q.Print.int 15 (iterate 5 succ 10);;

t @@ fun () ->
assert_raises
  (function
    | Invalid_argument _ -> true
    | _ -> false)
  (fun () -> iterate (-1) succ 10);
true
;;

t @@ fun () -> CCFun.((succ %> string_of_int) 2 = "3");;
t @@ fun () -> CCFun.((( * ) 3 % succ) 5 = 18);;
t @@ fun () -> CCFun.(succ @@ ( * ) 2 @@ pred @@ 3 = 5)