encoding_index_tests::single_byte_tests!
[-] [+]
[src]
macro_rules! single_byte_tests { ( mod = $parentmod:ident // XXX Rust issue #20701 prevents the use of `super` ) => ( mod tests { extern crate test; use $parentmod::{forward, backward}; use std::iter::range_inclusive; #[test] fn test_correct_table() { for i in range_inclusive(0x80u8, 0xff) { let j = forward(i); if j != 0xffff { assert_eq!(backward(j as u32), i); } } } #[bench] fn bench_forward_sequential_128(bencher: &mut test::Bencher) { bencher.iter(|| { for i in range_inclusive(0x80u8, 0xff) { test::black_box(forward(i)); } }) } #[bench] fn bench_backward_sequential_128(bencher: &mut test::Bencher) { let mut start: u32 = 0; bencher.iter(|| { for i in start..(start + 0x80) { test::black_box(backward(i)); } start += 0x80; }) } } ); }
Makes a common test suite for single-byte indices.