add some tests

This commit is contained in:
Simon Cruanes 2020-01-12 20:26:00 -06:00
parent 2b5f2fce11
commit 8c33147d06
2 changed files with 10 additions and 0 deletions

View file

@ -16,6 +16,11 @@ let of_int_exn = Char.chr
let of_int c = try Some (of_int_exn c) with _ -> None let of_int c = try Some (of_int_exn c) with _ -> None
let to_int = Char.code let to_int = Char.code
(*$=
(Some 'a') (of_int (to_int 'a'))
None (of_int 257)
*)
let to_string c = String.make 1 c let to_string c = String.make 1 c
(*$Q to_string (*$Q to_string

View file

@ -204,6 +204,11 @@ let of_string s =
try Some (int_of_string s) try Some (int_of_string s)
with _ -> None with _ -> None
(*$=
None (of_string "moo")
(Some 42) (of_string "42")
*)
type output = char -> unit type output = char -> unit
(* abstract printer *) (* abstract printer *)