Debian Codegraph @

tests/test_chunks.rs

raw symbols SCIP
1 mod commonrust-analyzer cargo qoi 0.4.1 common/;
2
3 use bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::{cast_slicerust-analyzer cargo bytemuck 1.25.2 cast_slice()., Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod#};
4
5 use qoirust-analyzer cargo qoi 0.4.1 crate/::constsrust-analyzer cargo qoi 0.4.1 consts/::{
6 QOI_HEADER_SIZErust-analyzer cargo qoi 0.4.1 consts/QOI_HEADER_SIZE., QOI_OP_DIFFrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_DIFF., QOI_OP_INDEXrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_INDEX., QOI_OP_LUMArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_LUMA., QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA., QOI_OP_RUNrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RUN.,
7 QOI_PADDING_SIZErust-analyzer cargo qoi 0.4.1 consts/QOI_PADDING_SIZE.,
8 };
9 use qoirust-analyzer cargo qoi 0.4.1 crate/::{decode_to_vecrust-analyzer cargo qoi 0.4.1 decode/decode_to_vec()., encode_to_vecrust-analyzer cargo qoi 0.4.1 encode/encode_to_vec().};
10
11 use selfrust-analyzer cargo qoi 0.4.1 crate/::commonrust-analyzer cargo qoi 0.4.1 common/::hashrust-analyzer cargo qoi 0.4.1 common/hash().;
12
13 fn test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().<P, E, const N: usize>(pixels: P, expected: E)
14 where
15 P: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[[u8; N]]>,
16 E: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[u8]>,
17 [u8; N]: Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod#,
18 {
19 let pixels = pixels.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().();
20 let expected = expected.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().();
21 let pixels_raw = cast_slicerust-analyzer cargo bytemuck 1.25.2 cast_slice().::<_, u8>(pixels);
22 let encoded = encode_to_vecrust-analyzer cargo qoi 0.4.1 encode/encode_to_vec().(pixels_raw, pixels.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as _, 1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
23 let decoded = decode_to_vecrust-analyzer cargo qoi 0.4.1 decode/decode_to_vec().(&encoded).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().1;
24 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(pixels_raw, decoded.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().(), "roundtrip failed (encoded={:?}))", encoded);
25 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(encoded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() >= expected.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). QOI_HEADER_SIZErust-analyzer cargo qoi 0.4.1 consts/QOI_HEADER_SIZE. +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). QOI_PADDING_SIZErust-analyzer cargo qoi 0.4.1 consts/QOI_PADDING_SIZE.);
26 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&encoded[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().QOI_HEADER_SIZErust-analyzer cargo qoi 0.4.1 consts/QOI_HEADER_SIZE...]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()...expected.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()., expected);
27 }
28
29 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
30 fn test_encode_rgb_3chrust-analyzer cargo qoi 0.4.1 test_encode_rgb_3ch().() {
31 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().([[11, 121, 231]], [QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., 11, 121, 231]);
32 }
33
34 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
35 fn test_encode_rgb_4chrust-analyzer cargo qoi 0.4.1 test_encode_rgb_4ch().() {
36 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().([[11, 121, 231, 0xff]], [QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., 11, 121, 231]);
37 }
38
39 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
40 fn test_encode_rgbarust-analyzer cargo qoi 0.4.1 test_encode_rgba().() {
41 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().([[11, 121, 231, 55]], [QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA., 11, 121, 231, 55]);
42 }
43
44 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
45 fn test_encode_run_start_len1to62_3chrust-analyzer cargo qoi 0.4.1 test_encode_run_start_len1to62_3ch().() {
46 for n in 1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#62 {
47 let mut v = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![[0, 0, 0]; n];
48 v.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().([11, 22, 33]);
49 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(v, [QOI_OP_RUNrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RUN. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().(n as u8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().1), QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB.]);
50 }
51 }
52
53 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
54 fn test_encode_run_start_len1to62_4chrust-analyzer cargo qoi 0.4.1 test_encode_run_start_len1to62_4ch().() {
55 for n in 1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#62 {
56 let mut v = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![[0, 0, 0, 0xff]; n];
57 v.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().([11, 22, 33, 44]);
58 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(v, [QOI_OP_RUNrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RUN. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().(n as u8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().1), QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA.]);
59 }
60 }
61
62 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
63 fn test_encode_run_start_63to124_3chrust-analyzer cargo qoi 0.4.1 test_encode_run_start_63to124_3ch().() {
64 for n in 63..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#124 {
65 let mut v = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![[0, 0, 0]; n];
66 v.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().([11, 22, 33]);
67 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(v, [QOI_OP_RUNrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RUN. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().61, QOI_OP_RUNrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RUN. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().(n as u8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().63), QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB.]);
68 }
69 }
70
71 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
72 fn test_encode_run_start_len63to124_4chrust-analyzer cargo qoi 0.4.1 test_encode_run_start_len63to124_4ch().() {
73 for n in 63..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#124 {
74 let mut v = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![[0, 0, 0, 0xff]; n];
75 v.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().([11, 22, 33, 44]);
76 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(v, [QOI_OP_RUNrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RUN. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().61, QOI_OP_RUNrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RUN. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().(n as u8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().63), QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA.]);
77 }
78 }
79
80 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
81 fn test_encode_run_end_3chrust-analyzer cargo qoi 0.4.1 test_encode_run_end_3ch().() {
82 let px = [11, 33, 55];
83 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(
84 [[1, 99, 2], px, px, px],
85 [QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., 1, 99, 2, QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., px[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., px[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., px[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., QOI_OP_RUNrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RUN. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().1],
86 );
87 }
88
89 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
90 fn test_encode_run_end_4chrust-analyzer cargo qoi 0.4.1 test_encode_run_end_4ch().() {
91 let px = [11, 33, 55, 77];
92 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(
93 [[1, 99, 2, 3], px, px, px],
94 [QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA., 1, 99, 2, 3, QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA., px[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., px[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., px[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., px[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., QOI_OP_RUNrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RUN. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().1],
95 );
96 }
97
98 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
99 fn test_encode_run_mid_3chrust-analyzer cargo qoi 0.4.1 test_encode_run_mid_3ch().() {
100 let px = [11, 33, 55];
101 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(
102 [[1, 99, 2], px, px, px, [1, 2, 3]],
103 [QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., 1, 99, 2, QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., px[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., px[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., px[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., QOI_OP_RUNrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RUN. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().1],
104 );
105 }
106
107 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
108 fn test_encode_run_mid_4chrust-analyzer cargo qoi 0.4.1 test_encode_run_mid_4ch().() {
109 let px = [11, 33, 55, 77];
110 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(
111 [[1, 99, 2, 3], px, px, px, [1, 2, 3, 4]],
112 [QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA., 1, 99, 2, 3, QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA., px[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., px[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., px[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., px[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., QOI_OP_RUNrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RUN. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().1],
113 );
114 }
115
116 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
117 fn test_encode_index_3chrust-analyzer cargo qoi 0.4.1 test_encode_index_3ch().() {
118 let px = [101, 102, 103];
119 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(
120 [px, [1, 2, 3], px],
121 [QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., 101, 102, 103, QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., 1, 2, 3, QOI_OP_INDEXrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_INDEX. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().hashrust-analyzer cargo qoi 0.4.1 common/hash().(px)],
122 );
123 }
124
125 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
126 fn test_encode_index_4chrust-analyzer cargo qoi 0.4.1 test_encode_index_4ch().() {
127 let px = [101, 102, 103, 104];
128 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(
129 [px, [1, 2, 3, 4], px],
130 [QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA., 101, 102, 103, 104, QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA., 1, 2, 3, 4, QOI_OP_INDEXrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_INDEX. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().hashrust-analyzer cargo qoi 0.4.1 common/hash().(px)],
131 );
132 }
133
134 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
135 fn test_encode_index_zero_3chrust-analyzer cargo qoi 0.4.1 test_encode_index_zero_3ch().() {
136 let px = [0, 0, 0];
137 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().([[101, 102, 103], px], [QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., 101, 102, 103, QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., 0, 0, 0]);
138 }
139
140 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
141 fn test_encode_index_zero_0x00_4chrust-analyzer cargo qoi 0.4.1 test_encode_index_zero_0x00_4ch().() {
142 let px = [0, 0, 0, 0];
143 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(
144 [[101, 102, 103, 104], px],
145 [QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA., 101, 102, 103, 104, QOI_OP_INDEXrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_INDEX. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().hashrust-analyzer cargo qoi 0.4.1 common/hash().(px)],
146 );
147 }
148
149 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
150 fn test_encode_index_zero_0xff_4chrust-analyzer cargo qoi 0.4.1 test_encode_index_zero_0xff_4ch().() {
151 let px = [0, 0, 0, 0xff];
152 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(
153 [[101, 102, 103, 104], px],
154 [QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA., 101, 102, 103, 104, QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA., 0, 0, 0, 0xff],
155 );
156 }
157
158 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
159 fn test_encode_diffrust-analyzer cargo qoi 0.4.1 test_encode_diff().() {
160 for x in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#8_u8 {
161 let x = [x.wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(5), x.wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(4), x.wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(3)];
162 for dr in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3 {
163 for dg in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3 {
164 for db in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3 {
165 if dr rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().2 || dg rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().2 || db rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().2 {
166 let r = x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(dr).wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(2);
167 let g = x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(dg).wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(2);
168 let b = x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(db).wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(2);
169 let d = QOI_OP_DIFFrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_DIFF. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().dr rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().dg rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().db;
170 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(
171 [[1, 99, 2], x, [r, g, b]],
172 [QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., 1, 99, 2, QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., d],
173 );
174 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(
175 [[1, 99, 2, 0xff], [x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., 9], [r, g, b, 9]],
176 [QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., 1, 99, 2, QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., 9, d],
177 );
178 }
179 }
180 }
181 }
182 }
183 }
184
185 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
186 fn test_encode_lumarust-analyzer cargo qoi 0.4.1 test_encode_luma().() {
187 for x in (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#200_u8).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(4) {
188 let x = [x.wrapping_mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_mul().(3), x.wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(5), x.wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(7)];
189 for dr_g in (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#16).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(4) {
190 for dg in (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#64).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(8) {
191 for db_g in (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#16).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(4) {
192 if dr_g rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().8 || dg rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().32 || db_g rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().8 {
193 let r = x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(dr_g).wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(dg).wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(40);
194 let g = x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(dg).wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(32);
195 let b = x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(db_g).wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(dg).wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(40);
196 let d1 = QOI_OP_LUMArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_LUMA. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().dg;
197 let d2 = (dr_g rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().4) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().db_g;
198 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(
199 [[1, 99, 2], x, [r, g, b]],
200 [QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., 1, 99, 2, QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., d1, d2],
201 );
202 test_chunkrust-analyzer cargo qoi 0.4.1 test_chunk().(
203 [[1, 99, 2, 0xff], [x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., 9], [r, g, b, 9]],
204 [QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., 1, 99, 2, QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., x[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., 9, d1, d2],
205 );
206 }
207 }
208 }
209 }
210 }
211 }