From dc1425e54a86c4273d76c6628dbcb3a739a606bc Mon Sep 17 00:00:00 2001 From: femsci Date: Thu, 29 Dec 2022 10:02:36 +0100 Subject: [PATCH] Expand serialization test variables. Add required enum derivations. --- src/store/local.rs | 14 ++++++++------ src/store/mod.rs | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/store/local.rs b/src/store/local.rs index f5c67b5..7c2e313 100644 --- a/src/store/local.rs +++ b/src/store/local.rs @@ -639,7 +639,7 @@ mod tests { #[test] fn localstore_record_serialize() { - let rec = LocalRecord { + let record = LocalRecord { position: 0, size: 0, record: StoreRecord { @@ -651,14 +651,16 @@ mod tests { }, }; - let deser = rec.serialize(); + let serialized = record.serialize(); - println!("D: {:x?}", deser); + println!("D: {:x?}", serialized); - let reser = LocalRecord::from_block(&deser).unwrap(); + let deserialized = LocalRecord::from_block(&serialized).unwrap(); - let redes = reser.serialize(); + assert_eq!(deserialized.record, record.record); - assert_eq!(deser, redes); + let reserialized = deserialized.serialize(); + + assert_eq!(serialized, reserialized); } } diff --git a/src/store/mod.rs b/src/store/mod.rs index 419e8d1..a577174 100644 --- a/src/store/mod.rs +++ b/src/store/mod.rs @@ -1,6 +1,7 @@ pub(crate) mod local; pub(crate) mod server; +#[derive(PartialEq, PartialOrd, Debug)] pub struct StoreRecord { specifier: String, key: String, @@ -9,7 +10,7 @@ pub struct StoreRecord { meta: Option, } -#[derive(Clone, Copy, PartialEq, PartialOrd)] +#[derive(Clone, Copy, PartialEq, PartialOrd, Debug)] pub enum RecordType { LOGIN_PASSWORD = 0, PASSWORD = 1,