diff options
| author | ยท๐๐ด๐๐๐ฉ๐ค | 2025-12-11 05:16:33 +0000 |
|---|---|---|
| committer | ยท๐๐ด๐๐๐ฉ๐ค | 2025-12-11 05:16:33 +0000 |
| commit | 36f4b89ea2ea987beab961c1c900ee796cb9ec51 (patch) | |
| tree | 4241e8629c1b7e603d5c1e4e9d68d041e3ac7052 /lib/uTF8.ml | |
| parent | 47b747fd39e13edc6c6bae741fadaddec14a3e79 (diff) | |
| download | nixtaml-36f4b89ea2ea987beab961c1c900ee796cb9ec51.tar nixtaml-36f4b89ea2ea987beab961c1c900ee796cb9ec51.tar.gz nixtaml-36f4b89ea2ea987beab961c1c900ee796cb9ec51.tar.bz2 nixtaml-36f4b89ea2ea987beab961c1c900ee796cb9ec51.tar.lz nixtaml-36f4b89ea2ea987beab961c1c900ee796cb9ec51.tar.xz nixtaml-36f4b89ea2ea987beab961c1c900ee796cb9ec51.tar.zst nixtaml-36f4b89ea2ea987beab961c1c900ee796cb9ec51.zip | |
UTF8 type
Diffstat (limited to 'lib/uTF8.ml')
| -rw-r--r-- | lib/uTF8.ml | 28 |
1 files changed, 28 insertions, 0 deletions
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 <https://toast.al/contact/> โ +โ 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) |
