/* * SPDX-FileCopyrightText: 2023 Inria * * SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later */ #![cfg(test)] use anyhow::Result; use epserde::prelude::*; use maligned::A16; #[derive(Epserde, Debug, PartialEq, Eq, Clone)] struct Data { a: A, b: [i32; Q], } #[test] fn test_cheaty_serialize() -> Result<()> { let a = vec![1, 2, 3, 4]; let s = a.as_slice(); let mut cursor = >::new(); s.serialize(&mut cursor)?; cursor.set_position(0); let b = >::deserialize_full(&mut cursor)?; assert_eq!(a, b.as_slice()); let b = >::deserialize_eps(cursor.as_bytes())?; assert_eq!(a, b); Ok(()) }