summaryrefslogtreecommitdiffstats
path: root/openpgp/src/types/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/src/types/mod.rs')
-rw-r--r--openpgp/src/types/mod.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/openpgp/src/types/mod.rs b/openpgp/src/types/mod.rs
index ddea9239..51f8acca 100644
--- a/openpgp/src/types/mod.rs
+++ b/openpgp/src/types/mod.rs
@@ -49,6 +49,7 @@ use std::fmt;
use std::str::FromStr;
use std::result;
+#[cfg(any(test, feature = "quickcheck"))]
use quickcheck::{Arbitrary, Gen};
use crate::Error;
@@ -273,12 +274,14 @@ impl fmt::Display for PublicKeyAlgorithm {
}
}
+#[cfg(any(test, feature = "quickcheck"))]
impl Arbitrary for PublicKeyAlgorithm {
fn arbitrary<G: Gen>(g: &mut G) -> Self {
u8::arbitrary(g).into()
}
}
+#[cfg(any(test, feature = "quickcheck"))]
impl PublicKeyAlgorithm {
pub(crate) fn arbitrary_for_signing<G: Gen>(g: &mut G) -> Self {
use rand::Rng;
@@ -509,6 +512,7 @@ impl Curve {
}
}
+#[cfg(any(test, feature = "quickcheck"))]
impl Arbitrary for Curve {
fn arbitrary<G: Gen>(g: &mut G) -> Self {
match u8::arbitrary(g) % 8 {
@@ -703,6 +707,7 @@ impl fmt::Display for SymmetricAlgorithm {
}
}
+#[cfg(any(test, feature = "quickcheck"))]
impl Arbitrary for SymmetricAlgorithm {
fn arbitrary<G: Gen>(g: &mut G) -> Self {
u8::arbitrary(g).into()
@@ -819,6 +824,7 @@ impl fmt::Display for AEADAlgorithm {
}
}
+#[cfg(any(test, feature = "quickcheck"))]
impl Arbitrary for AEADAlgorithm {
fn arbitrary<G: Gen>(g: &mut G) -> Self {
u8::arbitrary(g).into()
@@ -962,6 +968,7 @@ impl fmt::Display for CompressionAlgorithm {
}
}
+#[cfg(any(test, feature = "quickcheck"))]
impl Arbitrary for CompressionAlgorithm {
fn arbitrary<G: Gen>(g: &mut G) -> Self {
u8::arbitrary(g).into()
@@ -1096,6 +1103,7 @@ impl fmt::Display for HashAlgorithm {
}
}
+#[cfg(any(test, feature = "quickcheck"))]
impl Arbitrary for HashAlgorithm {
fn arbitrary<G: Gen>(g: &mut G) -> Self {
u8::arbitrary(g).into()
@@ -1253,6 +1261,7 @@ impl fmt::Display for SignatureType {
}
}
+#[cfg(any(test, feature = "quickcheck"))]
impl Arbitrary for SignatureType {
fn arbitrary<G: Gen>(g: &mut G) -> Self {
u8::arbitrary(g).into()
@@ -1397,6 +1406,7 @@ impl fmt::Display for ReasonForRevocation {
}
}
+#[cfg(any(test, feature = "quickcheck"))]
impl Arbitrary for ReasonForRevocation {
fn arbitrary<G: Gen>(g: &mut G) -> Self {
u8::arbitrary(g).into()
@@ -1644,6 +1654,7 @@ impl fmt::Display for DataFormat {
}
}
+#[cfg(any(test, feature = "quickcheck"))]
impl Arbitrary for DataFormat {
fn arbitrary<G: Gen>(g: &mut G) -> Self {
u8::arbitrary(g).into()