Finish coverage of veilid_api::types

This commit is contained in:
Teknique
2023-06-01 13:57:18 -07:00
parent ded3f22870
commit b397b5c66b
2 changed files with 55 additions and 7 deletions

View File

@@ -20,6 +20,29 @@ pub async fn test_alignedu64() {
assert_eq!(orig, copy);
}
// veilid_api/types/app_messsage_call.rs
pub async fn test_veilidappmessage() {
let orig = VeilidAppMessage {
sender: Some(fix_typedkey()),
message: b"Hi there!".to_vec(),
};
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
assert_eq!(orig, copy);
}
pub async fn test_veilidappcall() {
let orig = VeilidAppCall {
sender: Some(fix_typedkey()),
message: b"Well, hello!".to_vec(),
id: AlignedU64::from(123),
};
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
assert_eq!(orig, copy);
}
// veilid_api/types/fourcc.rs
pub async fn test_fourcc() {
@@ -31,6 +54,27 @@ pub async fn test_fourcc() {
// veilid_api/types/safety.rs
pub async fn test_sequencing() {
let orig = Sequencing::PreferOrdered;
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
assert_eq!(orig, copy);
}
pub async fn test_stability() {
let orig = Stability::Reliable;
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
assert_eq!(orig, copy);
}
pub async fn test_safetyselection() {
let orig = SafetySelection::Unsafe(Sequencing::EnsureOrdered);
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
assert_eq!(orig, copy);
}
pub async fn test_safetyspec() {
let orig = SafetySpec {
preferred_route: Some(fix_cryptokey()),
@@ -137,7 +181,7 @@ pub async fn test_partialtunnel() {
assert_eq!(orig, copy);
}
// veilid_api/types/veilid_lo.rs
// veilid_api/types/veilid_log.rs
pub async fn test_veilidloglevel() {
let orig = VeilidLogLevel::Info;
@@ -254,7 +298,12 @@ pub async fn test_veilidstate() {
pub async fn test_all() {
test_round_trip_peerinfo().await;
test_alignedu64().await;
test_veilidappmessage().await;
test_veilidappcall().await;
test_fourcc().await;
test_sequencing().await;
test_stability().await;
test_safetyselection().await;
test_safetyspec().await;
test_latencystats().await;
test_transferstats().await;
@@ -262,7 +311,6 @@ pub async fn test_all() {
test_rpcstats().await;
test_peerstats().await;
test_tunnelmode().await;
test_tunnelmode().await;
test_tunnelerror().await;
test_tunnelendpoint().await;
test_fulltunnel().await;