mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[ion/unicode] StringGlyphLength method
This commit is contained in:
committed by
EmilieNumworks
parent
1e64db68ef
commit
50bbae5e06
14
ion/test/utf8_helper.cpp
Normal file
14
ion/test/utf8_helper.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <quiz.h>
|
||||
#include <ion/unicode/utf8_helper.h>
|
||||
|
||||
void assert_string_glyph_length_is(const char * string, int maxSize, size_t result) {
|
||||
quiz_assert(UTF8Helper::StringGlyphLength(string, maxSize) == result);
|
||||
}
|
||||
|
||||
QUIZ_CASE(ion_utf8_helper_glyph_length) {
|
||||
assert_string_glyph_length_is("123", -1, 3);
|
||||
assert_string_glyph_length_is("1ᴇ3", -1, 3);
|
||||
assert_string_glyph_length_is("∑∫𝐢", -1, 3);
|
||||
assert_string_glyph_length_is("123", 2, 2);
|
||||
assert_string_glyph_length_is("1ᴇ3", 2, 1);
|
||||
}
|
||||
Reference in New Issue
Block a user