Improve wording, correct -> tight.
This commit is contained in:
parent
4304686049
commit
3f0d04e97b
1 changed files with 6 additions and 6 deletions
|
@ -1001,7 +1001,7 @@ fn test_split_iterators_size_hint() {
|
||||||
Lower,
|
Lower,
|
||||||
Upper,
|
Upper,
|
||||||
}
|
}
|
||||||
fn assert_precise_size_hints(mut it: impl Iterator, which: Bounds, context: impl fmt::Display) {
|
fn assert_tight_size_hints(mut it: impl Iterator, which: Bounds, ctx: impl fmt::Display) {
|
||||||
match which {
|
match which {
|
||||||
Bounds::Lower => {
|
Bounds::Lower => {
|
||||||
let mut lower_bounds = vec![it.size_hint().0];
|
let mut lower_bounds = vec![it.size_hint().0];
|
||||||
|
@ -1009,7 +1009,7 @@ fn test_split_iterators_size_hint() {
|
||||||
lower_bounds.push(it.size_hint().0);
|
lower_bounds.push(it.size_hint().0);
|
||||||
}
|
}
|
||||||
let target: Vec<_> = (0..lower_bounds.len()).rev().collect();
|
let target: Vec<_> = (0..lower_bounds.len()).rev().collect();
|
||||||
assert_eq!(lower_bounds, target, "incorrect lower bounds: {}", context);
|
assert_eq!(lower_bounds, target, "lower bounds incorrect or not tight: {}", ctx);
|
||||||
}
|
}
|
||||||
Bounds::Upper => {
|
Bounds::Upper => {
|
||||||
let mut upper_bounds = vec![it.size_hint().1];
|
let mut upper_bounds = vec![it.size_hint().1];
|
||||||
|
@ -1017,7 +1017,7 @@ fn test_split_iterators_size_hint() {
|
||||||
upper_bounds.push(it.size_hint().1);
|
upper_bounds.push(it.size_hint().1);
|
||||||
}
|
}
|
||||||
let target: Vec<_> = (0..upper_bounds.len()).map(Some).rev().collect();
|
let target: Vec<_> = (0..upper_bounds.len()).map(Some).rev().collect();
|
||||||
assert_eq!(upper_bounds, target, "incorrect upper bounds: {}", context);
|
assert_eq!(upper_bounds, target, "upper bounds incorrect or not tight: {}", ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1028,13 +1028,13 @@ fn test_split_iterators_size_hint() {
|
||||||
// p: predicate, b: bound selection
|
// p: predicate, b: bound selection
|
||||||
for (p, b) in [
|
for (p, b) in [
|
||||||
// with a predicate always returning false, the split*-iterators
|
// with a predicate always returning false, the split*-iterators
|
||||||
// become maximally short, so the size_hint lower bounds are correct
|
// become maximally short, so the size_hint lower bounds are tight
|
||||||
((|_| false) as fn(&_) -> _, Bounds::Lower),
|
((|_| false) as fn(&_) -> _, Bounds::Lower),
|
||||||
// with a predicate always returning true, the split*-iterators
|
// with a predicate always returning true, the split*-iterators
|
||||||
// become maximally long, so the size_hint upper bounds are correct
|
// become maximally long, so the size_hint upper bounds are tight
|
||||||
((|_| true) as fn(&_) -> _, Bounds::Upper),
|
((|_| true) as fn(&_) -> _, Bounds::Upper),
|
||||||
] {
|
] {
|
||||||
use assert_precise_size_hints as a;
|
use assert_tight_size_hints as a;
|
||||||
use format_args as f;
|
use format_args as f;
|
||||||
|
|
||||||
a(v.split(p), b, "split");
|
a(v.split(p), b, "split");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue