MCPcopy Create free account
hub / github.com/apache/fory / test_utf8

Function test_utf8

rust/fory-core/src/util/string_util.rs:1024–1045  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1022
1023 #[test]
1024 fn test_utf8() {
1025 let samples = [
1026 "hello",
1027 "rust语言",
1028 "你好,世界",
1029 "emoji 😀😃😄😁",
1030 "mixed ASCII + 中文 + emoji 😁",
1031 ];
1032
1033 for s in samples {
1034 let bytes_len = s.len();
1035
1036 let mut buffer = vec![];
1037 let mut writer = Writer::from_buffer(&mut buffer);
1038 write_utf8_standard(&mut writer, s);
1039 write_utf8_standard(&mut writer, s);
1040 let bytes = &*writer.dump();
1041 let mut reader = Reader::new(bytes);
1042 assert_eq!(read_utf8_standard(&mut reader, bytes_len).unwrap(), s);
1043 assert_eq!(read_utf8_standard(&mut reader, bytes_len).unwrap(), s);
1044 }
1045 }
1046
1047 #[test]
1048 fn test_utf16() {

Callers

nothing calls this directly

Calls 3

write_utf8_standardFunction · 0.85
lenMethod · 0.80
dumpMethod · 0.45

Tested by

no test coverage detected