Skip to content

Commit

Permalink
Added tests for CCChar predicates.
Browse files Browse the repository at this point in the history
mobotsar committed Jan 4, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent b95e2de commit 1486cbf
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/core/t_char.ml
Original file line number Diff line number Diff line change
@@ -8,3 +8,43 @@ eq None (of_int 257);;
q
(Q.string_of_size (Q.Gen.return 1))
(fun s -> Stdlib.( = ) (to_string s.[0]) s)
;;

q (Q.int_range 65 90 |> Q.map Char.chr) CCChar.is_uppercase_ascii;;

q
(Q.int_range 0 64 |> Q.map Char.chr)
(fun c -> not @@ CCChar.is_uppercase_ascii c)
;;

q
(Q.int_range 91 127 |> Q.map Char.chr)
(fun c -> not @@ CCChar.is_uppercase_ascii c)
;;

q (Q.int_range 97 122 |> Q.map Char.chr) CCChar.is_lowercase_ascii;;

q
(Q.int_range 0 96 |> Q.map Char.chr)
(fun c -> not @@ CCChar.is_lowercase_ascii c)
;;

q
(Q.int_range 123 127 |> Q.map Char.chr)
(fun c -> not @@ CCChar.is_lowercase_ascii c)
;;

q (Q.int_range 48 57 |> Q.map Char.chr) CCChar.is_digit_ascii;;
q (Q.int_range 0 47 |> Q.map Char.chr) (fun c -> not @@ CCChar.is_digit_ascii c)
;;

q
(Q.int_range 58 127 |> Q.map Char.chr)
(fun c -> not @@ CCChar.is_digit_ascii c)
;;

eq true (String.for_all CCChar.is_whitespace_ascii "\n\t \010\011\012\013");;

eq false
(String.for_all CCChar.is_whitespace_ascii
"Hello!--NOthina\055kag$$$%^bch\008h")

0 comments on commit 1486cbf

Please sign in to comment.