mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-09 20:55:31 -05:00
test: add stronger test to compare with uutf in ccutf8string
This commit is contained in:
parent
52abbcd978
commit
fcd1247ec8
1 changed files with 17 additions and 1 deletions
|
|
@ -334,6 +334,11 @@ let of_string s = if is_valid s then Some s else None
|
||||||
| `Malformed _ -> f (Uchar.of_int 0xfffd)
|
| `Malformed _ -> f (Uchar.of_int 0xfffd)
|
||||||
| `Uchar c -> f c)
|
| `Uchar c -> f c)
|
||||||
() s
|
() s
|
||||||
|
|
||||||
|
let uutf_of_l l =
|
||||||
|
let buf = Buffer.create 32 in
|
||||||
|
List.iter (Uutf.Buffer.add_utf_8 buf) l;
|
||||||
|
Buffer.contents buf
|
||||||
*)
|
*)
|
||||||
|
|
||||||
(*$R
|
(*$R
|
||||||
|
|
@ -362,7 +367,7 @@ let of_string s = if is_valid s then Some s else None
|
||||||
)
|
)
|
||||||
*)
|
*)
|
||||||
|
|
||||||
(*$QR & ~long_factor:10
|
(*$QR & ~long_factor:10 ~count:20_000
|
||||||
Q.(small_list arb_uchar) (fun l ->
|
Q.(small_list arb_uchar) (fun l ->
|
||||||
let s = of_list l in
|
let s = of_list l in
|
||||||
l = to_list s)
|
l = to_list s)
|
||||||
|
|
@ -421,6 +426,17 @@ let of_string s = if is_valid s then Some s else None
|
||||||
)
|
)
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
(*$QR & ~long_factor:40 ~count:50_000
|
||||||
|
Q.(small_list arb_uchar) (fun l ->
|
||||||
|
let pp s = Q.Print.(list pp_uchar) s in
|
||||||
|
let uutf = uutf_of_l l in
|
||||||
|
let s = (of_list l:>string) in
|
||||||
|
if uutf = s then true
|
||||||
|
else Q.Test.fail_reportf "l: '%s', uutf: '%s', containers: '%s'"
|
||||||
|
(pp l) uutf s
|
||||||
|
)
|
||||||
|
*)
|
||||||
|
|
||||||
(*$QR & ~long_factor:40 ~count:50_000
|
(*$QR & ~long_factor:40 ~count:50_000
|
||||||
Q.small_string (fun s ->
|
Q.small_string (fun s ->
|
||||||
Q.assume (is_valid s && uutf_is_valid s);
|
Q.assume (is_valid s && uutf_is_valid s);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue