From 36f4b89ea2ea987beab961c1c900ee796cb9ec51 Mon Sep 17 00:00:00 2001 From: ยท๐‘‘๐‘ด๐‘•๐‘‘๐‘ฉ๐‘ค Date: Thu, 11 Dec 2025 05:16:33 +0000 Subject: UTF8 type --- lib/uTF8.ml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lib/uTF8.ml (limited to 'lib/uTF8.ml') diff --git a/lib/uTF8.ml b/lib/uTF8.ml new file mode 100644 index 0000000..867046f --- /dev/null +++ b/lib/uTF8.ml @@ -0,0 +1,28 @@ +(*โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ SPDX-FileCopyrightText: 2025 toastal โ”‚ +โ”‚ SPDX-License-Identifier: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€*) +(* Extending Camomile *) +include Camomile.UTF8 + +let equal a b = compare a b = 0 + +let pp ppf str = Fmt.pf ppf "%s" str + +let gen_uchar : Camomile.UChar.t QCheck.Gen.t = + let open QCheck.Gen in + let* i = + oneof [ + int_range 0 0xD7FF; + int_range 0xE000 0x10FFFF; + ]; + in + return (Camomile.UChar.of_int i) + +let gen : t QCheck.Gen.t = + let open QCheck.Gen in + let* size = int_bound 40 in + let* chars = list_size (return size) gen_uchar in + let buf = Buf.create size in + List.iter (fun u -> Buf.add_char buf u) chars; + return (Buf.contents buf) -- cgit v1.2.3