#![cfg(test)]
use super::hash_buf;
#[test]
fn hash_buf_usage() {
#[cfg(not(feature = "alloc"))]
use std::string::ToString;
assert_eq!(
hash_buf(b"Hello, World!\n").unwrap().to_string(),
"3:aaX8v:aV"
);
}
#[cfg(not(miri))]
#[cfg(target_pointer_width = "64")]
#[test]
fn hash_buf_input_too_large() {
use crate::generate::{Generator, GeneratorError};
unsafe {
let too_large_size = (Generator::MAX_INPUT_SIZE + 1) as usize;
let buf =
core::slice::from_raw_parts(core::ptr::NonNull::dangling().as_ptr(), too_large_size);
assert_eq!(hash_buf(buf), Err(GeneratorError::FixedSizeTooLarge));
}
}