summaryrefslogtreecommitdiff
path: root/ocaml-binary-annot/testsuite/tests/basic-private/tlength.ml
diff options
context:
space:
mode:
Diffstat (limited to 'ocaml-binary-annot/testsuite/tests/basic-private/tlength.ml')
-rw-r--r--ocaml-binary-annot/testsuite/tests/basic-private/tlength.ml23
1 files changed, 23 insertions, 0 deletions
diff --git a/ocaml-binary-annot/testsuite/tests/basic-private/tlength.ml b/ocaml-binary-annot/testsuite/tests/basic-private/tlength.ml
new file mode 100644
index 0000000000..a428e20757
--- /dev/null
+++ b/ocaml-binary-annot/testsuite/tests/basic-private/tlength.ml
@@ -0,0 +1,23 @@
+(* $Id: tlength.ml 8482 2007-11-06 21:06:18Z weis $
+
+A testbed file for private type abbreviation definitions.
+
+We test the Length module that implements positive integers.
+
+*)
+
+(* We can build a null length. *)
+let l = Length.make 0;;
+
+
+(* We cannot build a negative length. *)
+try ignore (Length.make (-1)); assert false with
+| Failure _ -> ()
+;;
+
+
+(* We can build a positive length. *)
+let l3 = Length.make 3 in
+
+(* and use the associated injection and projection functions. *)
+Length.make (Length.from l3 + Length.from l3);;