use super::context::CudaContext;
use super::memory::GpuBuffer;
use crate::GpuError;
use proptest::prelude::*;
mod adversarial;
mod async_and_stress;
mod basic_operations;
proptest! {
#[test]
fn test_buffer_roundtrip_fuzz(
len in 1usize..100_000usize,
val in any::<f32>()
) {
if let Ok(ctx) = CudaContext::new(0) {
let mut buf = GpuBuffer::<f32>::new(&ctx, len).unwrap();
let data = vec![val; len];
buf.copy_from_host(&data).unwrap();
let mut out = vec![0.0; len];
buf.copy_to_host(&mut out).unwrap();
prop_assert_eq!(data[0], out[0]);
prop_assert_eq!(data[len/2], out[len/2]);
prop_assert_eq!(data[len-1], out[len-1]);
}
}
}