mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 10:31:50 +00:00
add StructMapping::setUnicode
This commit is contained in:
parent
4343e81e00
commit
77229b8d9a
3 changed files with 108 additions and 11 deletions
|
|
@ -24,3 +24,18 @@ TEST(StructMapper, ReadWrite) {
|
|||
mapping.setChars(buffer, "hello", "s");
|
||||
EXPECT_EQ(mapping.getChars(buffer, "s"), "hell");
|
||||
}
|
||||
|
||||
TEST(StructMapper, Unicode) {
|
||||
ubyte buffer[8] {};
|
||||
std::vector<Field> fields {
|
||||
Field {FieldType::CHAR, "text", 5},
|
||||
};
|
||||
auto mapping = StructMapping::create(fields);
|
||||
EXPECT_EQ(mapping.size(), 5);
|
||||
|
||||
mapping.setUnicode(buffer, u8"テキストデモ", "text");
|
||||
EXPECT_EQ(mapping.getChars(buffer, "text"), std::string(u8"テ"));
|
||||
|
||||
mapping.setUnicode(buffer, u8"пример", "text");
|
||||
EXPECT_EQ(mapping.getChars(buffer, "text"), std::string(u8"пр"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue