Ensure non-power-of-two sizes are tested in the Chars::count test

This commit is contained in:
Thom Chiovoloni 2021-10-30 14:04:49 -07:00
parent ed01324835
commit 002aaf2c65
No known key found for this signature in database
GPG Key ID: E2EFD4309E11C8A8
1 changed files with 4 additions and 2 deletions

View File

@ -2234,9 +2234,11 @@ fn utf8_chars() {
#[test]
fn utf8_char_counts() {
let strs = [("e", 1), ("é", 1), ("", 1), ("\u{10000}", 1), ("eé€\u{10000}", 4)];
let mut reps = vec![1, 8, 64, 256, 512, 1024];
let mut reps =
[8, 64, 256, 512, 1024].iter().copied().flat_map(|n| n - 8..=n + 8).collect::<Vec<usize>>();
if cfg!(not(miri)) {
reps.push(1 << 16);
let big = 1 << 16;
reps.extend(big - 8..=big + 8);
}
let counts = if cfg!(miri) { 0..1 } else { 0..8 };
let padding = counts.map(|len| " ".repeat(len)).collect::<Vec<String>>();