1 | use rayon::prelude::*; |
2 | use std::char; |
3 | |
4 | #[test] |
5 | fn half_open_correctness() { |
6 | let low = char::from_u32(0xD800 - 0x7).unwrap(); |
7 | let high = char::from_u32(0xE000 + 0x7).unwrap(); |
8 | |
9 | let range = low..high; |
10 | let mut chars: Vec<char> = range.into_par_iter().collect(); |
11 | chars.sort(); |
12 | |
13 | assert_eq!( |
14 | chars, |
15 | vec![ |
16 | ' \u{D7F9}' , ' \u{D7FA}' , ' \u{D7FB}' , ' \u{D7FC}' , ' \u{D7FD}' , ' \u{D7FE}' , ' \u{D7FF}' , |
17 | ' \u{E000}' , ' \u{E001}' , ' \u{E002}' , ' \u{E003}' , ' \u{E004}' , ' \u{E005}' , ' \u{E006}' , |
18 | ] |
19 | ); |
20 | } |
21 | |
22 | #[test] |
23 | fn closed_correctness() { |
24 | let low = char::from_u32(0xD800 - 0x7).unwrap(); |
25 | let high = char::from_u32(0xE000 + 0x7).unwrap(); |
26 | |
27 | let range = low..=high; |
28 | let mut chars: Vec<char> = range.into_par_iter().collect(); |
29 | chars.sort(); |
30 | |
31 | assert_eq!( |
32 | chars, |
33 | vec![ |
34 | ' \u{D7F9}' , ' \u{D7FA}' , ' \u{D7FB}' , ' \u{D7FC}' , ' \u{D7FD}' , ' \u{D7FE}' , ' \u{D7FF}' , |
35 | ' \u{E000}' , ' \u{E001}' , ' \u{E002}' , ' \u{E003}' , ' \u{E004}' , ' \u{E005}' , ' \u{E006}' , |
36 | ' \u{E007}' , |
37 | ] |
38 | ); |
39 | } |
40 | |