From 8c33147d0626ad2bb5dd197f146a29aa5c60e671 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sun, 12 Jan 2020 20:26:00 -0600 Subject: [PATCH] add some tests --- src/core/CCChar.ml | 5 +++++ src/core/CCInt.ml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/core/CCChar.ml b/src/core/CCChar.ml index 57556956..04b38d89 100644 --- a/src/core/CCChar.ml +++ b/src/core/CCChar.ml @@ -16,6 +16,11 @@ let of_int_exn = Char.chr let of_int c = try Some (of_int_exn c) with _ -> None let to_int = Char.code +(*$= + (Some 'a') (of_int (to_int 'a')) + None (of_int 257) +*) + let to_string c = String.make 1 c (*$Q to_string diff --git a/src/core/CCInt.ml b/src/core/CCInt.ml index 6cb7ba3e..1483dc87 100644 --- a/src/core/CCInt.ml +++ b/src/core/CCInt.ml @@ -204,6 +204,11 @@ let of_string s = try Some (int_of_string s) with _ -> None +(*$= + None (of_string "moo") + (Some 42) (of_string "42") +*) + type output = char -> unit (* abstract printer *)