| 1 | // Copyright (c) 2022 Harry [Majored] [[email protected]] |
| 2 | // MIT License (https://github.com/Majored/rs-async-zip/blob/main/LICENSE) |
| 3 | |
| 4 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 5 | fn search_one_byte_testrust-analyzer cargo async_zip 0.0.18 tests/read/locator/search_one_byte_test().() { |
| 6 | let buffer: &[u8] = &[0x0, 0x0, 0x0, 0x0, 0x0, 0x0]; |
| 7 | let signature: &[u8] = &[0x1]; |
| 8 | |
| 9 | let matched = craterust-analyzer cargo async_zip 0.0.18 crate/::baserust-analyzer cargo async_zip 0.0.18 base/::readrust-analyzer cargo async_zip 0.0.18 base/read/::iorust-analyzer cargo async_zip 0.0.18 base/read/io/::locatorrust-analyzer cargo async_zip 0.0.18 base/read/io/locator/::reverse_search_bufferrust-analyzer cargo async_zip 0.0.18 base/read/io/locator/reverse_search_buffer().(buffer, signature); |
| 10 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matched.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().()); |
| 11 | |
| 12 | let buffer: &[u8] = &[0x2, 0x1, 0x0, 0x0, 0x0, 0x0]; |
| 13 | let signature: &[u8] = &[0x1]; |
| 14 | |
| 15 | let matched = craterust-analyzer cargo async_zip 0.0.18 crate/::baserust-analyzer cargo async_zip 0.0.18 base/::readrust-analyzer cargo async_zip 0.0.18 base/read/::iorust-analyzer cargo async_zip 0.0.18 base/read/io/::locatorrust-analyzer cargo async_zip 0.0.18 base/read/io/locator/::reverse_search_bufferrust-analyzer cargo async_zip 0.0.18 base/read/io/locator/reverse_search_buffer().(buffer, signature); |
| 16 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matched.is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 17 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(1, matched.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()); |
| 18 | } |
| 19 | |
| 20 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 21 | fn search_two_byte_testrust-analyzer cargo async_zip 0.0.18 tests/read/locator/search_two_byte_test().() { |
| 22 | let buffer: &[u8] = &[0x2, 0x1, 0x0, 0x0, 0x0, 0x0]; |
| 23 | let signature: &[u8] = &[0x2, 0x1]; |
| 24 | |
| 25 | let matched = craterust-analyzer cargo async_zip 0.0.18 crate/::baserust-analyzer cargo async_zip 0.0.18 base/::readrust-analyzer cargo async_zip 0.0.18 base/read/::iorust-analyzer cargo async_zip 0.0.18 base/read/io/::locatorrust-analyzer cargo async_zip 0.0.18 base/read/io/locator/::reverse_search_bufferrust-analyzer cargo async_zip 0.0.18 base/read/io/locator/reverse_search_buffer().(buffer, signature); |
| 26 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matched.is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 27 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(1, matched.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()); |
| 28 | } |
| 29 | |
| 30 | #[tokiorust-analyzer cargo tokio 1.25.0 crate/::testrust-analyzer cargo tokio-macros 1.8.0 test:] |
| 31 | async fn locator_empty_testrust-analyzer cargo async_zip 0.0.18 tests/read/locator/locator_empty_test().() { |
| 32 | use futures_literust-analyzer cargo futures-lite 2.1.0 crate/::iorust-analyzer cargo futures-lite 2.1.0 io/::Cursorrust-analyzer cargo futures-lite 2.1.0 io/Cursor#; |
| 33 | |
| 34 | let data = &include_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/include_bytes!!("empty.zip"); |
| 35 | let mut cursor = Cursorrust-analyzer cargo futures-lite 2.1.0 io/Cursor#::newrust-analyzer cargo futures-lite 2.1.0 io/impl#[`Cursor<T>`]new().(data); |
| 36 | let eocdr = craterust-analyzer cargo async_zip 0.0.18 crate/::baserust-analyzer cargo async_zip 0.0.18 base/::readrust-analyzer cargo async_zip 0.0.18 base/read/::iorust-analyzer cargo async_zip 0.0.18 base/read/io/::locatorrust-analyzer cargo async_zip 0.0.18 base/read/io/locator/::eocdrrust-analyzer cargo async_zip 0.0.18 base/read/io/locator/eocdr().(&mut cursor).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 37 | |
| 38 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(eocdr.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().()); |
| 39 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(eocdr.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 4); |
| 40 | } |
| 41 | |
| 42 | #[tokiorust-analyzer cargo tokio 1.25.0 crate/::testrust-analyzer cargo tokio-macros 1.8.0 test:] |
| 43 | async fn locator_empty_max_comment_testrust-analyzer cargo async_zip 0.0.18 tests/read/locator/locator_empty_max_comment_test().() { |
| 44 | use futures_literust-analyzer cargo futures-lite 2.1.0 crate/::iorust-analyzer cargo futures-lite 2.1.0 io/::Cursorrust-analyzer cargo futures-lite 2.1.0 io/Cursor#; |
| 45 | |
| 46 | let data = &include_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/include_bytes!!("empty-with-max-comment.zip"); |
| 47 | let mut cursor = Cursorrust-analyzer cargo futures-lite 2.1.0 io/Cursor#::newrust-analyzer cargo futures-lite 2.1.0 io/impl#[`Cursor<T>`]new().(data); |
| 48 | let eocdr = craterust-analyzer cargo async_zip 0.0.18 crate/::baserust-analyzer cargo async_zip 0.0.18 base/::readrust-analyzer cargo async_zip 0.0.18 base/read/::iorust-analyzer cargo async_zip 0.0.18 base/read/io/::locatorrust-analyzer cargo async_zip 0.0.18 base/read/io/locator/::eocdrrust-analyzer cargo async_zip 0.0.18 base/read/io/locator/eocdr().(&mut cursor).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 49 | |
| 50 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(eocdr.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().()); |
| 51 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(eocdr.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 4); |
| 52 | } |
| 53 | |
| 54 | #[tokiorust-analyzer cargo tokio 1.25.0 crate/::testrust-analyzer cargo tokio-macros 1.8.0 test:] |
| 55 | async fn locator_buffer_boundary_testrust-analyzer cargo async_zip 0.0.18 tests/read/locator/locator_buffer_boundary_test().() { |
| 56 | use futures_literust-analyzer cargo futures-lite 2.1.0 crate/::iorust-analyzer cargo futures-lite 2.1.0 io/::Cursorrust-analyzer cargo futures-lite 2.1.0 io/Cursor#; |
| 57 | |
| 58 | let data = &include_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/include_bytes!!("empty-buffer-boundary.zip"); |
| 59 | let mut cursor = Cursorrust-analyzer cargo futures-lite 2.1.0 io/Cursor#::newrust-analyzer cargo futures-lite 2.1.0 io/impl#[`Cursor<T>`]new().(data); |
| 60 | let eocdr = craterust-analyzer cargo async_zip 0.0.18 crate/::baserust-analyzer cargo async_zip 0.0.18 base/::readrust-analyzer cargo async_zip 0.0.18 base/read/::iorust-analyzer cargo async_zip 0.0.18 base/read/io/::locatorrust-analyzer cargo async_zip 0.0.18 base/read/io/locator/::eocdrrust-analyzer cargo async_zip 0.0.18 base/read/io/locator/eocdr().(&mut cursor).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 61 | |
| 62 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(eocdr.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().()); |
| 63 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(eocdr.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 4); |
| 64 | } |