fix tests

This commit is contained in:
John Smith
2023-06-16 14:18:34 -04:00
parent f3a3d5322c
commit 9ffcc0da87
13 changed files with 73 additions and 51 deletions
+1 -5
View File
@@ -212,10 +212,6 @@ pub fn fix_veilidvaluechange() -> VeilidValueChange {
key: fix_typedkey(),
subkeys: vec![1, 2, 3, 4],
count: 5,
value: ValueData {
seq: 23,
data: b"ValueData".to_vec(),
writer: fix_cryptokey(),
},
value: ValueData::new_with_seq(23, b"ValueData".to_vec(), fix_cryptokey()),
}
}
@@ -13,21 +13,18 @@ pub async fn test_alignedu64() {
// app_messsage_call
pub async fn test_veilidappmessage() {
let orig = VeilidAppMessage {
sender: Some(fix_typedkey()),
message: b"Hi there!".to_vec(),
};
let orig = VeilidAppMessage::new(Some(fix_typedkey()), 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(),
call_id: AlignedU64::from(123),
};
let orig = VeilidAppCall::new(
Some(fix_typedkey()),
b"Well, hello!".to_vec(),
AlignedU64::from(123),
);
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
assert_eq!(orig, copy);
@@ -5,12 +5,12 @@ use range_set_blaze::*;
// dht_record_descriptors
pub async fn test_dhtrecorddescriptor() {
let orig = DHTRecordDescriptor {
key: fix_typedkey(),
owner: fix_cryptokey(),
owner_secret: Some(fix_cryptokey()),
schema: DHTSchema::DFLT(DHTSchemaDFLT { o_cnt: 4321 }),
};
let orig = DHTRecordDescriptor::new(
fix_typedkey(),
fix_cryptokey(),
Some(fix_cryptokey()),
DHTSchema::DFLT(DHTSchemaDFLT { o_cnt: 4321 }),
);
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
assert_eq!(orig, copy);
@@ -19,11 +19,7 @@ pub async fn test_dhtrecorddescriptor() {
// value_data
pub async fn test_valuedata() {
let orig = ValueData {
seq: 42,
data: b"Brent Spiner".to_vec(),
writer: fix_cryptokey(),
};
let orig = ValueData::new_with_seq(42, b"Brent Spiner".to_vec(), fix_cryptokey());
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
assert_eq!(orig, copy);
@@ -32,9 +28,7 @@ pub async fn test_valuedata() {
// value_subkey_range_set
pub async fn test_valuesubkeyrangeset() {
let orig = ValueSubkeyRangeSet {
data: RangeSetBlaze::from_iter([20..=30]),
};
let orig = ValueSubkeyRangeSet::new_with_data(RangeSetBlaze::from_iter([20..=30]));
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
assert_eq!(orig, copy);