Expand serialization test variables. Add required enum derivations.
This commit is contained in:
parent
444e15e3ca
commit
dc1425e54a
2 changed files with 10 additions and 7 deletions
|
@ -639,7 +639,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn localstore_record_serialize() {
|
fn localstore_record_serialize() {
|
||||||
let rec = LocalRecord {
|
let record = LocalRecord {
|
||||||
position: 0,
|
position: 0,
|
||||||
size: 0,
|
size: 0,
|
||||||
record: StoreRecord {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
pub(crate) mod local;
|
pub(crate) mod local;
|
||||||
pub(crate) mod server;
|
pub(crate) mod server;
|
||||||
|
|
||||||
|
#[derive(PartialEq, PartialOrd, Debug)]
|
||||||
pub struct StoreRecord {
|
pub struct StoreRecord {
|
||||||
specifier: String,
|
specifier: String,
|
||||||
key: String,
|
key: String,
|
||||||
|
@ -9,7 +10,7 @@ pub struct StoreRecord {
|
||||||
meta: Option<String>,
|
meta: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, PartialOrd)]
|
#[derive(Clone, Copy, PartialEq, PartialOrd, Debug)]
|
||||||
pub enum RecordType {
|
pub enum RecordType {
|
||||||
LOGIN_PASSWORD = 0,
|
LOGIN_PASSWORD = 0,
|
||||||
PASSWORD = 1,
|
PASSWORD = 1,
|
||||||
|
|
Loading…
Reference in a new issue