Lolly 1.4.27
Loading...
Searching...
No Matches
Functions
unicode_test.cpp File Reference
#include "a_lolly_test.hpp"
#include "lolly/data/unicode.hpp"
Include dependency graph for unicode_test.cpp:

Go to the source code of this file.

Functions

 TEST_CASE ("unicode_get_range")
 
 TEST_CASE ("cjk_unified_ideographs")
 
 TEST_CASE ("utf16 to utf8")
 
 TEST_CASE ("utf8 to utf16")
 

Function Documentation

◆ TEST_CASE() [1/4]

TEST_CASE ( "unicode_get_range" )

Definition at line 25 of file unicode_test.cpp.

25 {
26 string_eq (unicode_get_range ((int) 'a'), "ascii");
27 string_eq (unicode_get_range (0x2460), "enclosed_alphanumerics"); // ①
28 string_eq (unicode_get_range (0x24ff), "enclosed_alphanumerics"); // ⓿
29}
void string_eq(string left, string right)

◆ TEST_CASE() [2/4]

TEST_CASE ( "cjk_unified_ideographs" )

Definition at line 31 of file unicode_test.cpp.

31 {
32 CHECK (is_cjk_unified_ideographs ("<#4E2D>"));
33 CHECK (has_cjk_unified_ideographs ("<#4E2D>"));
34 CHECK (has_cjk_unified_ideographs ("bib-<#4E2D>"));
35 CHECK (!is_cjk_unified_ideographs ("bib-<#4E2D>"));
36}
The list class represents a linked list.
Definition list.hpp:48

◆ TEST_CASE() [3/4]

TEST_CASE ( "utf16 to utf8" )

Definition at line 42 of file unicode_test.cpp.

42 {
43 string t= "";
44 string_eq (utf16_to_utf8 ("\x4E\x2D"), "中");
45 t << '\x00' << '\x61';
46 string_eq (utf16_to_utf8 (t), "a");
47 t= "";
48 t << '\x00' << '\x61' << '\x00' << '\x62';
49 string_eq (utf16_to_utf8 (t), "ab");
50 t= "";
51 t << '\x00';
52 string_eq (utf16_to_utf8 (t), "");
53 t= "";
54 t << '\x00' << '\x61' << '\x00';
55 string_eq (utf16_to_utf8 (t), "a");
56}
blackbox t[13]

◆ TEST_CASE() [4/4]

TEST_CASE ( "utf8 to utf16" )

Definition at line 58 of file unicode_test.cpp.

58 {
59 string t= "";
60 t << '\x4E' << '\x2D';
61 string_eq (utf8_to_utf16 ("中"), t);
62 t= "";
63 t << '\x00' << '\x61';
64 string_eq (utf8_to_utf16 ("a"), t);
65 t= "";
66 t << '\x00' << '\x61' << '\x00' << '\x62';
67 string_eq (utf8_to_utf16 ("ab"), t);
68}