mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-11-25 10:10:41 -06:00
Finish coverage of veilid_api::types
This commit is contained in:
parent
ded3f22870
commit
b397b5c66b
@ -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;
|
||||
|
@ -8,10 +8,10 @@ use super::*;
|
||||
pub struct VeilidAppMessage {
|
||||
/// Some(sender) if the message was sent directly, None if received via a private/safety route
|
||||
#[serde(with = "opt_json_as_string")]
|
||||
sender: Option<TypedKey>,
|
||||
pub sender: Option<TypedKey>,
|
||||
/// The content of the message to deliver to the application
|
||||
#[serde(with = "json_as_base64")]
|
||||
message: Vec<u8>,
|
||||
pub message: Vec<u8>,
|
||||
}
|
||||
|
||||
impl VeilidAppMessage {
|
||||
@ -35,13 +35,13 @@ impl VeilidAppMessage {
|
||||
pub struct VeilidAppCall {
|
||||
/// Some(sender) if the request was sent directly, None if received via a private/safety route
|
||||
#[serde(with = "opt_json_as_string")]
|
||||
sender: Option<TypedKey>,
|
||||
pub sender: Option<TypedKey>,
|
||||
/// The content of the request to deliver to the application
|
||||
#[serde(with = "json_as_base64")]
|
||||
message: Vec<u8>,
|
||||
pub message: Vec<u8>,
|
||||
/// The id to reply to
|
||||
#[serde(with = "json_as_string")]
|
||||
id: OperationId,
|
||||
pub id: OperationId,
|
||||
}
|
||||
|
||||
impl VeilidAppCall {
|
||||
|
Loading…
Reference in New Issue
Block a user