#![cfg(test)]
#[test]
fn basic_works() {
super::zstd_decode(
&include_bytes!("./example-runtime.wasm.zstd")[..],
10 * 1024 * 1024,
)
.unwrap();
}
#[test]
fn limit_reached() {
assert!(matches!(
super::zstd_decode(
&include_bytes!("./example-runtime.wasm.zstd")[..],
16 * 1024
),
Err(super::Error::TooLarge)
));
}
#[test]
fn invalid_data() {
assert!(matches!(
super::zstd_decode(&(0..2048).map(|_| 0xff).collect::<Vec<_>>(), 1024 * 1024),
Err(super::Error::InvalidZstd)
));
}
#[test]
fn basic_works_with_header() {
super::zstd_decode_if_necessary(
&include_bytes!("./polkadot-runtime-v9160.wasm.zstd")[..],
10 * 1024 * 1024,
)
.unwrap();
}