Additional unicode tests
Coverage report is addicting
This commit is contained in:
parent
df1f90d827
commit
03d02d608c
@ -4,6 +4,16 @@
|
||||
using namespace boost::ut;
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
void test_encoding(
|
||||
u32 rune,
|
||||
std::string_view expected,
|
||||
reflection::source_location sl = reflection::source_location::current())
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << utf8::Print{rune};
|
||||
expect(eq(ss.str(), expected), sl);
|
||||
}
|
||||
|
||||
suite utf8_test = [] {
|
||||
"UTF-8 Character length"_test = [] {
|
||||
expect(utf8::length(" ") == 1_u);
|
||||
@ -18,4 +28,11 @@ suite utf8_test = [] {
|
||||
expect(eq(utf8::decode("\u2705").first, 0x2705u));
|
||||
expect(eq(utf8::decode("\U000132d1").first, 0x132d1u));
|
||||
};
|
||||
|
||||
"UTF-8 Character encoding"_test = [] {
|
||||
test_encoding(0x20u, " ");
|
||||
test_encoding(0x105u, "ą");
|
||||
test_encoding(0x2705u, "\u2705");
|
||||
test_encoding(0x132d1u, "\U000132d1");
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user