Extend test_format_u8 to include u8::MAX
This is equivalent to looping 0..=u8::MAX, except that `..=` syntax is not supported on old rustc and `...` syntax is not supported on new rustc, so loop it is.
This commit is contained in:
parent
1bb23ad9d1
commit
72060b779a
@ -706,10 +706,17 @@ fn format_u8(mut n: u8, out: &mut [u8]) -> usize {
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_format_u8() {
|
fn test_format_u8() {
|
||||||
for i in 0..(u8::MAX as u16) {
|
let mut i = 0u8;
|
||||||
|
|
||||||
|
loop {
|
||||||
let mut buf = [0u8; 3];
|
let mut buf = [0u8; 3];
|
||||||
let written = format_u8(i as u8, &mut buf);
|
let written = format_u8(i, &mut buf);
|
||||||
assert_eq!(i.to_string().as_bytes(), &buf[..written]);
|
assert_eq!(i.to_string().as_bytes(), &buf[..written]);
|
||||||
|
|
||||||
|
match i.checked_add(1) {
|
||||||
|
Some(next) => i = next,
|
||||||
|
None => break,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user