blob: 875758b3dafee2a1e44e8182ce22747b5b0ccd53 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
(***********************************************************************)
(* *)
(* OCaml *)
(* *)
(* Gabriel Scherer, projet Gallium, INRIA Rocquencourt *)
(* *)
(* Copyright 2012 Institut National de Recherche en Informatique et *)
(* en Automatique. All rights reserved. This file is distributed *)
(* under the terms of the Q Public License version 1.0. *)
(* *)
(***********************************************************************)
(* a simple test with mutually recursive functions *)
let test =
let rec even = function
| 0 -> true
| n -> odd (n - 1)
and odd = function
| 0 -> false
| n -> even (n - 1)
in
List.iter (fun i -> assert (even i <> odd i && even i = (i mod 2 = 0)))
[0;1;2;3;4;5;6]
|