diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-03-31 17:17:28 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-04-01 16:15:00 +0200 |
commit | 1403b50a82e24fd696f367b82ef18ce9f8c6f4c3 (patch) | |
tree | 646bfb9d91f6c8e61853e50efd9cdc74451dfa35 /openpgp | |
parent | 3501ddd9bc4dcd58b2aa02c006d2f0cf0199a503 (diff) |
openpgp: New roundtrip test for Packet.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/packet/mod.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/openpgp/src/packet/mod.rs b/openpgp/src/packet/mod.rs index 087814e3..db63da71 100644 --- a/openpgp/src/packet/mod.rs +++ b/openpgp/src/packet/mod.rs @@ -1073,10 +1073,21 @@ impl DerefMut for AED { #[cfg(test)] mod test { use super::*; + use crate::serialize::SerializeInto; + use crate::parse::Parse; #[test] fn packet_is_send_and_sync() { fn f<T: Send + Sync>(_: T) {} f(Packet::Marker(Default::default())); } + + quickcheck! { + fn roundtrip(p: Packet) -> bool { + let buf = p.to_vec().expect("Failed to serialize packet"); + let q = Packet::from_bytes(&buf).unwrap(); + assert_eq!(p, q); + true + } + } } |