mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-12-24 23:09:25 -05:00
Added 1st simple rkyv serializer test
This commit is contained in:
parent
4994f54039
commit
1654d03ad2
@ -12,3 +12,4 @@ use super::*;
|
||||
pub use common::*;
|
||||
pub use crypto::tests::*;
|
||||
pub use network_manager::tests::*;
|
||||
pub use veilid_api::tests::*;
|
||||
|
@ -3,6 +3,7 @@
|
||||
use crate::crypto::tests::*;
|
||||
use crate::network_manager::tests::*;
|
||||
use crate::tests::common::*;
|
||||
use crate::veilid_api::tests::*;
|
||||
use crate::*;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -163,5 +164,14 @@ cfg_if! {
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn run_test_serialize_rkyv() {
|
||||
setup();
|
||||
block_on(async {
|
||||
test_serialize_rkyv::test_all().await;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ mod routing_context;
|
||||
mod serialize_helpers;
|
||||
mod types;
|
||||
|
||||
pub mod tests;
|
||||
|
||||
pub use api::*;
|
||||
pub use debug::*;
|
||||
pub use error::*;
|
||||
|
3
veilid-core/src/veilid_api/tests/mod.rs
Normal file
3
veilid-core/src/veilid_api/tests/mod.rs
Normal file
@ -0,0 +1,3 @@
|
||||
pub mod test_serialize_rkyv;
|
||||
|
||||
use super::*;
|
16
veilid-core/src/veilid_api/tests/test_serialize_rkyv.rs
Normal file
16
veilid-core/src/veilid_api/tests/test_serialize_rkyv.rs
Normal file
@ -0,0 +1,16 @@
|
||||
use crate::*;
|
||||
|
||||
pub async fn test_simple_string() {
|
||||
let plain = "basic string".to_string();
|
||||
let serialized = b"basic string\x0c\x00\x00\x00\xf4\xff\xff\xff".to_vec();
|
||||
|
||||
let a = to_rkyv(&plain);
|
||||
assert_eq!(a.unwrap(), serialized);
|
||||
|
||||
let b = from_rkyv::<String>(serialized);
|
||||
assert_eq!(b.unwrap(), plain);
|
||||
}
|
||||
|
||||
pub async fn test_all() {
|
||||
test_simple_string().await;
|
||||
}
|
Loading…
Reference in New Issue
Block a user