Skip to content

Commit

Permalink
arch: add a second big endian regression test
Browse files Browse the repository at this point in the history
It turns out that the previous regression test wasn't failing for me on
the `powerpc64-unknown-linux-gnu` target. But quickcheck found a case
that was, so I added a second regression test specifically for that
case.
  • Loading branch information
BurntSushi committed Jun 14, 2024
1 parent 92edbb6 commit aee9f95
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/arch/all/memchr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,15 @@ mod tests {
assert_eq!(One::new(b':').find(b"1:23"), Some(1));
}

// Interestingly, I couldn't get `regression_big_endian1` to fail for me
// on the `powerpc64-unknown-linux-gnu` target. But I found another case
// through quickcheck that does.
#[test]
fn regression_big_endian2() {
let data = [0, 0, 0, 0, 0, 0, 0, 0];
assert_eq!(One::new(b'\x00').find(&data), Some(0));
}

// Generate 500K values.
fn special_values() -> impl Iterator<Item = usize> {
fn all_bytes() -> impl Iterator<Item = u8> {
Expand Down

0 comments on commit aee9f95

Please sign in to comment.