mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
add some tests
This commit is contained in:
parent
2b5f2fce11
commit
8c33147d06
2 changed files with 10 additions and 0 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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 *)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue