use super::*;
#[test]
fn printable_as_go_says() {
for (r, print) in [
(u32::from('a'), true),
(0x20, true),
(0xA0, false),
(0x1F, false),
(0x85, false),
(0xAD, false),
(0xE09C, false),
(0x10_FFFF, false),
(0xFFFD, true),
(0xD800, false),
(0x0301, true),
(0x1F600, true),
] {
assert_eq!(is_print(r), print, "U+{r:04X}");
}
}
#[test]
fn case_maps_one_to_one() {
assert_eq!(to_upper('ß'), 'ß');
assert_eq!(to_upper('é'), 'É');
assert_eq!(to_upper('Dž'), 'DŽ');
assert_eq!(to_lower('İ'), 'i');
assert_eq!(to_lower('O'), 'o');
}
#[test]
fn runes_decode_as_go_decodes_them() {
assert_eq!(decode_rune(b"a"), ('a', 1));
assert_eq!(decode_rune("é!".as_bytes()), ('é', 2));
assert_eq!(decode_rune(b"\xc3"), (REPLACEMENT, 1));
assert_eq!(decode_rune(b"\xed\xa0\x80"), (REPLACEMENT, 1));
assert_eq!(decode_rune(b"\xff"), (REPLACEMENT, 1));
assert_eq!(decode_rune("\u{FFFD}".as_bytes()), (REPLACEMENT, 3));
}