Sha256: 0f86c7ee7c966ac51cdce874c119f94953aefd00b743e1888d22c5713b7733fc

Contents?: true

Size: 1.05 KB

Versions: 13

Compression:

Stored size: 1.05 KB

Contents

use super::{compress, decompress};

const TEXT: &str = include_str!("../../assets/example.txt");

#[test]
fn test_direct() {
    // Can we include_str!("assets/example.txt")?
    // It's excluded from the packaging step, so maybe not.
    crate::test_cycle_unwrap(
        TEXT.as_bytes(),
        |data| compress(data, 1),
        |data| decompress(data, TEXT.len()),
    );
}

#[test]
fn test_stream_compat() {
    // We can bulk-compress and stream-decode
    crate::test_cycle_unwrap(
        TEXT.as_bytes(),
        |data| compress(data, 1),
        |data| crate::decode_all(data),
    );

    // We can stream-encode and bulk-decompress
    crate::test_cycle_unwrap(
        TEXT.as_bytes(),
        |data| crate::encode_all(data, 1),
        |data| decompress(data, TEXT.len()),
    );
}

#[test]
fn has_content_size() {
    let compressed = compress(TEXT.as_bytes(), 1).unwrap();

    // Bulk functions by default include the content size.
    assert_eq!(
        zstd_safe::get_frame_content_size(&compressed).unwrap(),
        Some(TEXT.len() as u64)
    );
}

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/zstd-0.13.2/src/bulk/tests.rs
wasmtime-28.0.0 ./ext/cargo-vendor/zstd-0.13.2/src/bulk/tests.rs
wasmtime-27.0.0 ./ext/cargo-vendor/zstd-0.13.2/src/bulk/tests.rs
wasmtime-26.0.0 ./ext/cargo-vendor/zstd-0.13.2/src/bulk/tests.rs
wasmtime-25.0.2 ./ext/cargo-vendor/zstd-0.13.2/src/bulk/tests.rs
wasmtime-25.0.1 ./ext/cargo-vendor/zstd-0.13.2/src/bulk/tests.rs
wasmtime-25.0.0 ./ext/cargo-vendor/zstd-0.13.2/src/bulk/tests.rs
wasmtime-24.0.0 ./ext/cargo-vendor/zstd-0.13.2/src/bulk/tests.rs
wasmtime-23.0.2 ./ext/cargo-vendor/zstd-0.13.1/src/bulk/tests.rs
wasmtime-22.0.0 ./ext/cargo-vendor/zstd-0.13.1/src/bulk/tests.rs
wasmtime-21.0.1 ./ext/cargo-vendor/zstd-0.13.1/src/bulk/tests.rs
wasmtime-20.0.2 ./ext/cargo-vendor/zstd-0.13.1/src/bulk/tests.rs
wasmtime-20.0.0 ./ext/cargo-vendor/zstd-0.13.1/src/bulk/tests.rs