| 1 | extern crate suppositionsrust-analyzer cargo hex-slice 0.1.4 suppositions/; |
| 2 | extern crate hex_slicerust-analyzer cargo hex-slice 0.1.4 hex_slice/; |
| 3 | use hex_slicerust-analyzer cargo hex-slice 0.1.4 crate/::AsHexrust-analyzer cargo hex-slice 0.1.4 AsHex#; |
| 4 | |
| 5 | use suppositionsrust-analyzer cargo suppositions 0.1.4 crate/::*; |
| 6 | use suppositionsrust-analyzer cargo suppositions 0.1.4 crate/::generatorsrust-analyzer cargo suppositions 0.1.4 generators/::*; |
| 7 | |
| 8 | |
| 9 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 10 | fn should_start_and_end_with_square_bracketsrust-analyzer cargo hex-slice 0.1.4 should_start_and_end_with_square_brackets().() { |
| 11 | propertyrust-analyzer cargo suppositions 0.1.4 properties/property().(vecsrust-analyzer cargo suppositions 0.1.4 generators/vecs().(u8srust-analyzer cargo suppositions 0.1.4 generators/u8s().())) |
| 12 | .checkrust-analyzer cargo suppositions 0.1.4 properties/impl#[`Property<G>`]check().(|data| { |
| 13 | let s = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:x}", data.as_hexrust-analyzer cargo hex-slice 0.1.4 impl#[`[T]`][AsHex]as_hex().()); |
| 14 | let len = s.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().(); |
| 15 | let first = s.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]get().(..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#1); |
| 16 | let last = s.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]get().(len-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#); |
| 17 | first rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("[") && last rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("]") |
| 18 | }); |
| 19 | } |
| 20 | |
| 21 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 22 | fn should_group_u8_as_blocks_of_tworust-analyzer cargo hex-slice 0.1.4 should_group_u8_as_blocks_of_two().() { |
| 23 | propertyrust-analyzer cargo suppositions 0.1.4 properties/property().(vecsrust-analyzer cargo suppositions 0.1.4 generators/vecs().(u8srust-analyzer cargo suppositions 0.1.4 generators/u8s().()).maprust-analyzer cargo suppositions 0.1.4 generators/Generator#map().(|data| (data.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().(), formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:02x}", data.as_hexrust-analyzer cargo hex-slice 0.1.4 impl#[`[T]`][AsHex]as_hex().())))) |
| 24 | .checkrust-analyzer cargo suppositions 0.1.4 properties/impl#[`Property<G>`]check().(|(_, s)| { |
| 25 | let len = s.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().(); |
| 26 | let body = match s.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]get().(1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#len-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1) { |
| 27 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(slice) => slice, |
| 28 | // Should always have a middle. |
| 29 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return false, |
| 30 | }; |
| 31 | |
| 32 | body.split_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_whitespace().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(|chunk| chunk.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().2) |
| 33 | }); |
| 34 | } |
| 35 | |
| 36 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 37 | fn should_group_u32_as_blocks_of_eight_when_specifiedrust-analyzer cargo hex-slice 0.1.4 should_group_u32_as_blocks_of_eight_when_specified().() { |
| 38 | propertyrust-analyzer cargo suppositions 0.1.4 properties/property().(vecsrust-analyzer cargo suppositions 0.1.4 generators/vecs().(u32srust-analyzer cargo suppositions 0.1.4 generators/u32s().()).maprust-analyzer cargo suppositions 0.1.4 generators/Generator#map().(|data| (data.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().(), formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:08x}", data.as_hexrust-analyzer cargo hex-slice 0.1.4 impl#[`[T]`][AsHex]as_hex().())))) |
| 39 | .checkrust-analyzer cargo suppositions 0.1.4 properties/impl#[`Property<G>`]check().(|(_, s)| { |
| 40 | let len = s.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().(); |
| 41 | let body = match s.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]get().(1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#len-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1) { |
| 42 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(slice) => slice, |
| 43 | // Should always have a middle. |
| 44 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return false, |
| 45 | }; |
| 46 | |
| 47 | body.split_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_whitespace().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(|chunk| chunk.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().8) |
| 48 | }); |
| 49 | } |
| 50 | |
| 51 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 52 | fn should_be_decodable_as_original_datarust-analyzer cargo hex-slice 0.1.4 should_be_decodable_as_original_data().() { |
| 53 | propertyrust-analyzer cargo suppositions 0.1.4 properties/property().(vecsrust-analyzer cargo suppositions 0.1.4 generators/vecs().(u32srust-analyzer cargo suppositions 0.1.4 generators/u32s().()).maprust-analyzer cargo suppositions 0.1.4 generators/Generator#map().(|data| (data.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().(), formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:x}", data.as_hexrust-analyzer cargo hex-slice 0.1.4 impl#[`[T]`][AsHex]as_hex().())))) |
| 54 | .checkrust-analyzer cargo suppositions 0.1.4 properties/impl#[`Property<G>`]check().(|(orig, s)| -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<bool, _> { |
| 55 | let len = s.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().(); |
| 56 | let body = match s.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]get().(1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#len-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1) { |
| 57 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(slice) => slice, |
| 58 | // Should always have a middle. |
| 59 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(false), |
| 60 | }; |
| 61 | |
| 62 | body.split_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_whitespace().() |
| 63 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|chunk| u32::from_str_radixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_str_radix().(chunk, 16)) |
| 64 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u32>, _>>() |
| 65 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|d| d rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().orig) |
| 66 | }); |
| 67 | } |
| 68 | |
| 69 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 70 | fn plain_hex_should_group_u8_as_blocks_of_tworust-analyzer cargo hex-slice 0.1.4 plain_hex_should_group_u8_as_blocks_of_two().() { |
| 71 | propertyrust-analyzer cargo suppositions 0.1.4 properties/property().(vecsrust-analyzer cargo suppositions 0.1.4 generators/vecs().(u8srust-analyzer cargo suppositions 0.1.4 generators/u8s().()).maprust-analyzer cargo suppositions 0.1.4 generators/Generator#map().(|data| (data.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().(), formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:02x}", data.plain_hexrust-analyzer cargo hex-slice 0.1.4 impl#[`[T]`][AsHex]plain_hex().(true))))) |
| 72 | .checkrust-analyzer cargo suppositions 0.1.4 properties/impl#[`Property<G>`]check().(|(_, s)| { |
| 73 | s.split_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_whitespace().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(|chunk| chunk.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().2) |
| 74 | }); |
| 75 | } |
| 76 | |
| 77 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 78 | fn plain_hex_should_group_u32_as_blocks_of_eight_when_specifiedrust-analyzer cargo hex-slice 0.1.4 plain_hex_should_group_u32_as_blocks_of_eight_when_specified().() { |
| 79 | propertyrust-analyzer cargo suppositions 0.1.4 properties/property().(vecsrust-analyzer cargo suppositions 0.1.4 generators/vecs().(u32srust-analyzer cargo suppositions 0.1.4 generators/u32s().()).maprust-analyzer cargo suppositions 0.1.4 generators/Generator#map().(|data| (data.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().(), formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:08x}", data.plain_hexrust-analyzer cargo hex-slice 0.1.4 impl#[`[T]`][AsHex]plain_hex().(true))))) |
| 80 | .checkrust-analyzer cargo suppositions 0.1.4 properties/impl#[`Property<G>`]check().(|(_, s)| { |
| 81 | s.split_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_whitespace().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(|chunk| chunk.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().8) |
| 82 | }); |
| 83 | } |
| 84 | |
| 85 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 86 | fn plain_hex_should_be_decodable_as_original_datarust-analyzer cargo hex-slice 0.1.4 plain_hex_should_be_decodable_as_original_data().() { |
| 87 | propertyrust-analyzer cargo suppositions 0.1.4 properties/property().(vecsrust-analyzer cargo suppositions 0.1.4 generators/vecs().(u32srust-analyzer cargo suppositions 0.1.4 generators/u32s().()).maprust-analyzer cargo suppositions 0.1.4 generators/Generator#map().(|data| (data.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().(), formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:x}", data.plain_hexrust-analyzer cargo hex-slice 0.1.4 impl#[`[T]`][AsHex]plain_hex().(true))))) |
| 88 | .checkrust-analyzer cargo suppositions 0.1.4 properties/impl#[`Property<G>`]check().(|(orig, s)| -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<bool, _> { |
| 89 | s.split_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_whitespace().() |
| 90 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|chunk| u32::from_str_radixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_str_radix().(chunk, 16)) |
| 91 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u32>, _>>() |
| 92 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|d| d rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().orig) |
| 93 | }); |
| 94 | } |