Sha256: 59846080bb59899c51fc2e1f488af7cab75612125b0f0001cbf2e12527a8bd4b

Contents?: true

Size: 1.03 KB

Versions: 25

Compression:

Stored size: 1.03 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),
        TEXT.len() as u64
    );
}

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
wasmtime-18.0.3 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-17.0.1 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-17.0.0 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-16.0.0 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-15.0.1 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-15.0.0 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-14.0.4 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-14.0.3 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-14.0.1 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-14.0.0 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-13.0.0 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-12.0.1 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-12.0.0 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-11.0.0 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-10.0.1 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-10.0.0 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-9.0.4 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-9.0.1 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-8.0.0 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs
wasmtime-7.0.0 ./ext/cargo-vendor/zstd-0.11.2+zstd.1.5.2/src/bulk/tests.rs