Remove commented code

This commit is contained in:
aniampio
2021-11-03 15:41:14 +00:00
parent 70a28d3767
commit 9b945acba3
-68
View File
@@ -330,72 +330,4 @@ mod tests {
assert_eq!(expected_bytes, bytes);
assert_eq!(ciphertext, Ciphertext::try_from(&bytes[..]).unwrap())
}
#[test]
#[cfg(feature = "serde")]
fn serde_bincode_private_key_roundtrip() {
use super::*;
let mut params = Parameters::default();
let keypair = keygen(&mut params);
let encoded = bincode::serialize(keypair.private_key()).unwrap();
let decoded: PrivateKey = bincode::deserialize(&encoded).unwrap();
assert_eq!(encoded.len(), 32);
// their raw bytes are the same
assert_eq!(decoded.to_bytes(), keypair.private_key.to_bytes());
// it can also be deserialized directly from the raw bytes
let raw_bytes = keypair.private_key.to_bytes();
let decoded_raw: PrivateKey = bincode::deserialize(&raw_bytes).unwrap();
assert_eq!(decoded_raw.to_bytes(), keypair.private_key.to_bytes());
}
#[test]
#[cfg(feature = "serde")]
fn serde_bincode_public_key_roundtrip() {
use super::*;
let mut params = Parameters::default();
let keypair = keygen(&mut params);
let encoded = bincode::serialize(keypair.public_key()).unwrap();
let decoded: PublicKey = bincode::deserialize(&encoded).unwrap();
assert_eq!(encoded.len(), 48);
assert_eq!(decoded.0, keypair.public_key.0);
// it can also be deserialized directly from the raw bytes
let raw_bytes = keypair.public_key.to_bytes();
let decoded_raw: PublicKey = bincode::deserialize(&raw_bytes).unwrap();
assert_eq!(decoded_raw.0, keypair.public_key.0);
}
// #[test]
// #[cfg(feature = "serde")]
// fn serde_bincode_ciphertext_roundtrip() {
// use super::*;
//
// let mut params = Parameters::default();
// let keypair = keygen(&mut params);
// let m = params.random_scalar();
// let h = G1Projective::random(OsRng);
//
// let (ciphertext, _) = keypair.public_key.encrypt(&mut params, &h, &m);
//
// let encoded = bincode::serialize(&ciphertext).unwrap();
// let decoded: Ciphertext = bincode::deserialize(&encoded).unwrap();
//
// assert_eq!(encoded.len(), 96);
// assert_eq!(decoded.0, ciphertext.0);
// assert_eq!(decoded.1, ciphertext.1);
//
// // it can also be deserialized directly from the raw bytes
// let raw_bytes = ciphertext.to_bytes();
//
// let decoded_raw: Ciphertext = bincode::deserialize(&raw_bytes).unwrap();
// assert_eq!(decoded_raw.0, ciphertext.0);
// assert_eq!(decoded_raw.1, ciphertext.1);
// }
}