| 1 | use superrust-analyzer cargo zstd 0.13.3 bulk/::{compressrust-analyzer cargo zstd 0.13.3 bulk/compress()., decompressrust-analyzer cargo zstd 0.13.3 bulk/decompress().}; |
| 2 | |
| 3 | const TEXTrust-analyzer cargo zstd 0.13.3 bulk/tests/TEXT.: &str = include_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/include_str!!("../../assets/example.txt"); |
| 4 | |
| 5 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 6 | fn test_directrust-analyzer cargo zstd 0.13.3 bulk/tests/test_direct().() { |
| 7 | // Can we include_str!("assets/example.txt")? |
| 8 | // It's excluded from the packaging step, so maybe not. |
| 9 | craterust-analyzer cargo zstd 0.13.3 crate/::test_cycle_unwraprust-analyzer cargo zstd 0.13.3 test_cycle_unwrap().( |
| 10 | TEXTrust-analyzer cargo zstd 0.13.3 bulk/tests/TEXT..as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(), |
| 11 | |data| compressrust-analyzer cargo zstd 0.13.3 bulk/compress().(data, 1), |
| 12 | |data| decompressrust-analyzer cargo zstd 0.13.3 bulk/decompress().(data, TEXTrust-analyzer cargo zstd 0.13.3 bulk/tests/TEXT..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()), |
| 13 | ); |
| 14 | } |
| 15 | |
| 16 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 17 | fn test_stream_compatrust-analyzer cargo zstd 0.13.3 bulk/tests/test_stream_compat().() { |
| 18 | // We can bulk-compress and stream-decode |
| 19 | craterust-analyzer cargo zstd 0.13.3 crate/::test_cycle_unwraprust-analyzer cargo zstd 0.13.3 test_cycle_unwrap().( |
| 20 | TEXTrust-analyzer cargo zstd 0.13.3 bulk/tests/TEXT..as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(), |
| 21 | |data| compressrust-analyzer cargo zstd 0.13.3 bulk/compress().(data, 1), |
| 22 | |data| craterust-analyzer cargo zstd 0.13.3 crate/::decode_allrust-analyzer cargo zstd 0.13.3 stream/functions/decode_all().(data), |
| 23 | ); |
| 24 | |
| 25 | // We can stream-encode and bulk-decompress |
| 26 | craterust-analyzer cargo zstd 0.13.3 crate/::test_cycle_unwraprust-analyzer cargo zstd 0.13.3 test_cycle_unwrap().( |
| 27 | TEXTrust-analyzer cargo zstd 0.13.3 bulk/tests/TEXT..as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(), |
| 28 | |data| craterust-analyzer cargo zstd 0.13.3 crate/::encode_allrust-analyzer cargo zstd 0.13.3 stream/functions/encode_all().(data, 1), |
| 29 | |data| decompressrust-analyzer cargo zstd 0.13.3 bulk/decompress().(data, TEXTrust-analyzer cargo zstd 0.13.3 bulk/tests/TEXT..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()), |
| 30 | ); |
| 31 | } |
| 32 | |
| 33 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 34 | fn has_content_sizerust-analyzer cargo zstd 0.13.3 bulk/tests/has_content_size().() { |
| 35 | let compressed = compressrust-analyzer cargo zstd 0.13.3 bulk/compress().(TEXTrust-analyzer cargo zstd 0.13.3 bulk/tests/TEXT..as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(), 1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 36 | |
| 37 | // Bulk functions by default include the content size. |
| 38 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 39 | zstd_saferust-analyzer cargo zstd-safe 7.2.2 crate/::get_frame_content_sizerust-analyzer cargo zstd-safe 7.2.2 get_frame_content_size().(&compressed).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 40 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(TEXTrust-analyzer cargo zstd 0.13.3 bulk/tests/TEXT..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() as u64) |
| 41 | ); |
| 42 | } |