mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-11-25 10:10:41 -06:00
Rearrangement for easier scaling of test count
This commit is contained in:
parent
b397b5c66b
commit
cb49477490
@ -1,5 +1,7 @@
|
||||
use crate::*;
|
||||
|
||||
const SERIALIZED_PEERINFO: &str = r###"{"node_ids":["FAKE:eFOfgm_FNZBsTRi7KAESNwYFAUGgX2uDrTRWAL8ucjM"],"signed_node_info":{"Direct":{"node_info":{"network_class":"InboundCapable","outbound_protocols":1,"address_types":3,"envelope_support":[0],"crypto_support":[[86,76,68,48]],"dial_info_detail_list":[{"class":"Direct","dial_info":{"kind":"UDP","socket_address":{"address":{"IPV4":"1.2.3.4"},"port":5150}}},{"class":"Direct","dial_info":{"kind":"UDP","socket_address":{"address":{"IPV6":"bad:cafe::1"},"port":5150}}},{"class":"Direct","dial_info":{"kind":"TCP","socket_address":{"address":{"IPV4":"5.6.7.8"},"port":5150}}},{"class":"Direct","dial_info":{"kind":"TCP","socket_address":{"address":{"IPV6":"bad:cafe::1"},"port":5150}}},{"class":"Direct","dial_info":{"kind":"WS","socket_address":{"address":{"IPV4":"9.10.11.12"},"port":5150},"request":"bootstrap-1.dev.veilid.net:5150/ws"}},{"class":"Direct","dial_info":{"kind":"WS","socket_address":{"address":{"IPV6":"bad:cafe::1"},"port":5150},"request":"bootstrap-1.dev.veilid.net:5150/ws"}}]},"timestamp":1685058646770389,"signatures":[]}}}"###;
|
||||
|
||||
fn fake_routing_table() -> routing_table::RoutingTable {
|
||||
let veilid_config = VeilidConfig::new();
|
||||
let block_store = BlockStore::new(veilid_config.clone());
|
||||
@ -79,6 +81,15 @@ pub async fn test_routingtable_buckets_round_trip() {
|
||||
copy.terminate().await;
|
||||
}
|
||||
|
||||
pub async fn test_round_trip_peerinfo() {
|
||||
let pi: routing_table::PeerInfo = deserialize_json(SERIALIZED_PEERINFO).unwrap();
|
||||
|
||||
let back = serialize_json(pi);
|
||||
|
||||
assert_eq!(SERIALIZED_PEERINFO, back);
|
||||
}
|
||||
|
||||
pub async fn test_all() {
|
||||
test_routingtable_buckets_round_trip().await;
|
||||
test_round_trip_peerinfo().await;
|
||||
}
|
||||
|
@ -2,8 +2,6 @@ use crate::*;
|
||||
|
||||
// Fixtures used by various tests
|
||||
|
||||
pub const SERIALIZED_PEERINFO: &str = r###"{"node_ids":["FAKE:eFOfgm_FNZBsTRi7KAESNwYFAUGgX2uDrTRWAL8ucjM"],"signed_node_info":{"Direct":{"node_info":{"network_class":"InboundCapable","outbound_protocols":1,"address_types":3,"envelope_support":[0],"crypto_support":[[86,76,68,48]],"dial_info_detail_list":[{"class":"Direct","dial_info":{"kind":"UDP","socket_address":{"address":{"IPV4":"1.2.3.4"},"port":5150}}},{"class":"Direct","dial_info":{"kind":"UDP","socket_address":{"address":{"IPV6":"bad:cafe::1"},"port":5150}}},{"class":"Direct","dial_info":{"kind":"TCP","socket_address":{"address":{"IPV4":"5.6.7.8"},"port":5150}}},{"class":"Direct","dial_info":{"kind":"TCP","socket_address":{"address":{"IPV6":"bad:cafe::1"},"port":5150}}},{"class":"Direct","dial_info":{"kind":"WS","socket_address":{"address":{"IPV4":"9.10.11.12"},"port":5150},"request":"bootstrap-1.dev.veilid.net:5150/ws"}},{"class":"Direct","dial_info":{"kind":"WS","socket_address":{"address":{"IPV6":"bad:cafe::1"},"port":5150},"request":"bootstrap-1.dev.veilid.net:5150/ws"}}]},"timestamp":1685058646770389,"signatures":[]}}}"###;
|
||||
|
||||
pub fn fix_latencystats() -> LatencyStats {
|
||||
LatencyStats {
|
||||
fastest: AlignedU64::from(1234),
|
||||
|
@ -1,3 +1,4 @@
|
||||
mod fixtures;
|
||||
pub mod test_serialize_json;
|
||||
pub mod test_serialize_rkyv;
|
||||
mod test_types;
|
||||
|
@ -1,302 +1,6 @@
|
||||
use super::fixtures::*;
|
||||
use crate::*;
|
||||
|
||||
// routing_table/types/peer_info.rs
|
||||
|
||||
pub async fn test_round_trip_peerinfo() {
|
||||
let pi: routing_table::PeerInfo = deserialize_json(SERIALIZED_PEERINFO).unwrap();
|
||||
|
||||
let back = serialize_json(pi);
|
||||
|
||||
assert_eq!(SERIALIZED_PEERINFO, back);
|
||||
}
|
||||
|
||||
// veilid_api/types/aligned_u64.rs
|
||||
|
||||
pub async fn test_alignedu64() {
|
||||
let orig = AlignedU64::new(0x0123456789abcdef);
|
||||
let copy = deserialize_json(&serialize_json(orig)).unwrap();
|
||||
|
||||
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() {
|
||||
let orig = FourCC::from_str("D34D").unwrap();
|
||||
let copy = deserialize_json(&serialize_json(orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
// 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()),
|
||||
hop_count: 23,
|
||||
stability: Stability::default(),
|
||||
sequencing: Sequencing::default(),
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
// veilid_api/types/stats.rs
|
||||
|
||||
pub async fn test_latencystats() {
|
||||
let orig = fix_latencystats();
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_transferstats() {
|
||||
let orig = fix_transferstats();
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_transferstatsdownup() {
|
||||
let orig = fix_transferstatsdownup();
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_rpcstats() {
|
||||
let orig = fix_rpcstats();
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_peerstats() {
|
||||
let orig = fix_peerstats();
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
// veilid_api/types/tunnel.rs
|
||||
|
||||
pub async fn test_tunnelmode() {
|
||||
let orig = TunnelMode::Raw;
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
pub async fn test_tunnelerror() {
|
||||
let orig = TunnelError::NoCapacity;
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_tunnelendpoint() {
|
||||
let orig = TunnelEndpoint {
|
||||
mode: TunnelMode::Raw,
|
||||
description: "Here there be tygers.".to_string(),
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_fulltunnel() {
|
||||
let orig = FullTunnel {
|
||||
id: AlignedU64::from(42),
|
||||
timeout: AlignedU64::from(3_000_000),
|
||||
local: TunnelEndpoint {
|
||||
mode: TunnelMode::Turn,
|
||||
description: "Left end.".to_string(),
|
||||
},
|
||||
remote: TunnelEndpoint {
|
||||
mode: TunnelMode::Turn,
|
||||
description: "Right end.".to_string(),
|
||||
},
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_partialtunnel() {
|
||||
let orig = PartialTunnel {
|
||||
id: AlignedU64::from(42),
|
||||
timeout: AlignedU64::from(3_000_000),
|
||||
local: TunnelEndpoint {
|
||||
mode: TunnelMode::Turn,
|
||||
description: "I'm so lonely.".to_string(),
|
||||
},
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
// veilid_api/types/veilid_log.rs
|
||||
|
||||
pub async fn test_veilidloglevel() {
|
||||
let orig = VeilidLogLevel::Info;
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidlog() {
|
||||
let orig = VeilidLog {
|
||||
log_level: VeilidLogLevel::Debug,
|
||||
message: "A log! A log!".to_string(),
|
||||
backtrace: Some("Func1 -> Func2 -> Func3".to_string()),
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
// veilid_api/types/veilid_state.rs
|
||||
|
||||
pub async fn test_attachmentstate() {
|
||||
let orig = AttachmentState::FullyAttached;
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidstateattachment() {
|
||||
let orig = VeilidStateAttachment {
|
||||
state: AttachmentState::OverAttached,
|
||||
public_internet_ready: true,
|
||||
local_network_ready: false,
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_peertabledata() {
|
||||
let orig = fix_peertabledata();
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidstatenetwork() {
|
||||
let orig = VeilidStateNetwork {
|
||||
started: true,
|
||||
bps_down: AlignedU64::from(14_400),
|
||||
bps_up: AlignedU64::from(1200),
|
||||
peers: vec![fix_peertabledata()],
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidroutechange() {
|
||||
let orig = VeilidRouteChange {
|
||||
dead_routes: vec![fix_cryptokey()],
|
||||
dead_remote_routes: vec![fix_cryptokey()],
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidstateconfig() {
|
||||
let orig = VeilidStateConfig {
|
||||
config: fix_veilidconfiginner(),
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidvaluechange() {
|
||||
let orig = fix_veilidvaluechange();
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidupdate() {
|
||||
let orig = VeilidUpdate::ValueChange(fix_veilidvaluechange());
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidstate() {
|
||||
let orig = VeilidState {
|
||||
attachment: VeilidStateAttachment {
|
||||
state: AttachmentState::OverAttached,
|
||||
public_internet_ready: true,
|
||||
local_network_ready: false,
|
||||
},
|
||||
network: VeilidStateNetwork {
|
||||
started: true,
|
||||
bps_down: AlignedU64::from(14_400),
|
||||
bps_up: AlignedU64::from(1200),
|
||||
peers: vec![fix_peertabledata()],
|
||||
},
|
||||
config: VeilidStateConfig {
|
||||
config: fix_veilidconfiginner(),
|
||||
},
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
use super::test_types::*;
|
||||
|
||||
pub async fn test_all() {
|
||||
test_round_trip_peerinfo().await;
|
||||
test_alignedu64().await;
|
||||
test_veilidappmessage().await;
|
||||
test_veilidappcall().await;
|
||||
|
286
veilid-core/src/veilid_api/tests/test_types.rs
Normal file
286
veilid-core/src/veilid_api/tests/test_types.rs
Normal file
@ -0,0 +1,286 @@
|
||||
use super::fixtures::*;
|
||||
use crate::*;
|
||||
|
||||
// veilid_api/types/aligned_u64.rs
|
||||
|
||||
pub async fn test_alignedu64() {
|
||||
let orig = AlignedU64::new(0x0123456789abcdef);
|
||||
let copy = deserialize_json(&serialize_json(orig)).unwrap();
|
||||
|
||||
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() {
|
||||
let orig = FourCC::from_str("D34D").unwrap();
|
||||
let copy = deserialize_json(&serialize_json(orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
// 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()),
|
||||
hop_count: 23,
|
||||
stability: Stability::default(),
|
||||
sequencing: Sequencing::default(),
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
// veilid_api/types/stats.rs
|
||||
|
||||
pub async fn test_latencystats() {
|
||||
let orig = fix_latencystats();
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_transferstats() {
|
||||
let orig = fix_transferstats();
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_transferstatsdownup() {
|
||||
let orig = fix_transferstatsdownup();
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_rpcstats() {
|
||||
let orig = fix_rpcstats();
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_peerstats() {
|
||||
let orig = fix_peerstats();
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
// veilid_api/types/tunnel.rs
|
||||
|
||||
pub async fn test_tunnelmode() {
|
||||
let orig = TunnelMode::Raw;
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
pub async fn test_tunnelerror() {
|
||||
let orig = TunnelError::NoCapacity;
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_tunnelendpoint() {
|
||||
let orig = TunnelEndpoint {
|
||||
mode: TunnelMode::Raw,
|
||||
description: "Here there be tygers.".to_string(),
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_fulltunnel() {
|
||||
let orig = FullTunnel {
|
||||
id: AlignedU64::from(42),
|
||||
timeout: AlignedU64::from(3_000_000),
|
||||
local: TunnelEndpoint {
|
||||
mode: TunnelMode::Turn,
|
||||
description: "Left end.".to_string(),
|
||||
},
|
||||
remote: TunnelEndpoint {
|
||||
mode: TunnelMode::Turn,
|
||||
description: "Right end.".to_string(),
|
||||
},
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_partialtunnel() {
|
||||
let orig = PartialTunnel {
|
||||
id: AlignedU64::from(42),
|
||||
timeout: AlignedU64::from(3_000_000),
|
||||
local: TunnelEndpoint {
|
||||
mode: TunnelMode::Turn,
|
||||
description: "I'm so lonely.".to_string(),
|
||||
},
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
// veilid_api/types/veilid_log.rs
|
||||
|
||||
pub async fn test_veilidloglevel() {
|
||||
let orig = VeilidLogLevel::Info;
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidlog() {
|
||||
let orig = VeilidLog {
|
||||
log_level: VeilidLogLevel::Debug,
|
||||
message: "A log! A log!".to_string(),
|
||||
backtrace: Some("Func1 -> Func2 -> Func3".to_string()),
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
// veilid_api/types/veilid_state.rs
|
||||
|
||||
pub async fn test_attachmentstate() {
|
||||
let orig = AttachmentState::FullyAttached;
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidstateattachment() {
|
||||
let orig = VeilidStateAttachment {
|
||||
state: AttachmentState::OverAttached,
|
||||
public_internet_ready: true,
|
||||
local_network_ready: false,
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_peertabledata() {
|
||||
let orig = fix_peertabledata();
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidstatenetwork() {
|
||||
let orig = VeilidStateNetwork {
|
||||
started: true,
|
||||
bps_down: AlignedU64::from(14_400),
|
||||
bps_up: AlignedU64::from(1200),
|
||||
peers: vec![fix_peertabledata()],
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidroutechange() {
|
||||
let orig = VeilidRouteChange {
|
||||
dead_routes: vec![fix_cryptokey()],
|
||||
dead_remote_routes: vec![fix_cryptokey()],
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidstateconfig() {
|
||||
let orig = VeilidStateConfig {
|
||||
config: fix_veilidconfiginner(),
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidvaluechange() {
|
||||
let orig = fix_veilidvaluechange();
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidupdate() {
|
||||
let orig = VeilidUpdate::ValueChange(fix_veilidvaluechange());
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
||||
|
||||
pub async fn test_veilidstate() {
|
||||
let orig = VeilidState {
|
||||
attachment: VeilidStateAttachment {
|
||||
state: AttachmentState::OverAttached,
|
||||
public_internet_ready: true,
|
||||
local_network_ready: false,
|
||||
},
|
||||
network: VeilidStateNetwork {
|
||||
started: true,
|
||||
bps_down: AlignedU64::from(14_400),
|
||||
bps_up: AlignedU64::from(1200),
|
||||
peers: vec![fix_peertabledata()],
|
||||
},
|
||||
config: VeilidStateConfig {
|
||||
config: fix_veilidconfiginner(),
|
||||
},
|
||||
};
|
||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||
|
||||
assert_eq!(orig, copy);
|
||||
}
|
Loading…
Reference in New Issue
Block a user