summaryrefslogtreecommitdiffstats
path: root/openpgp/src/tests.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-05-13 13:13:22 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-05-13 14:47:51 +0200
commit6ecb30381b3e7f5efd1f46808566aa75c339b658 (patch)
tree44ff47bbb53ddd31e63048e16d770dce2af8de84 /openpgp/src/tests.rs
parent34687bd6dd750edaadfc76ba0bbe28dd401dd655 (diff)
openpgp: New module containing the test data.
Diffstat (limited to 'openpgp/src/tests.rs')
-rw-r--r--openpgp/src/tests.rs53
1 files changed, 53 insertions, 0 deletions
diff --git a/openpgp/src/tests.rs b/openpgp/src/tests.rs
new file mode 100644
index 00000000..cc8aa569
--- /dev/null
+++ b/openpgp/src/tests.rs
@@ -0,0 +1,53 @@
+//! Test data for Sequoia.
+//!
+//! This module includes the test data from `openpgp/tests/data` in a
+//! structured way.
+
+use std::fmt;
+
+pub struct Test {
+ path: &'static str,
+ pub bytes: &'static [u8],
+}
+
+impl fmt::Display for Test {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "openpgp/tests/data/{}", self.path)
+ }
+}
+
+macro_rules! t {
+ ( $path: expr ) => {
+ &Test {
+ path: $path,
+ bytes: include_bytes!(concat!("../tests/data/", $path)),
+ }
+ }
+}
+
+pub const TPKS: &[&Test] = &[
+ t!("keys/dennis-simon-anton.pgp"),
+ t!("keys/dsa2048-elgamal3072.pgp"),
+ t!("keys/emmelie-dorothea-dina-samantha-awina-ed25519.pgp"),
+ t!("keys/erika-corinna-daniela-simone-antonia-nistp256.pgp"),
+ t!("keys/erika-corinna-daniela-simone-antonia-nistp384.pgp"),
+ t!("keys/erika-corinna-daniela-simone-antonia-nistp521.pgp"),
+ t!("keys/testy-new.pgp"),
+ t!("keys/testy.pgp"),
+ t!("keys/neal.pgp"),
+ t!("keys/dkg-sigs-out-of-order.pgp"),
+];
+
+pub const TSKS: &[&Test] = &[
+ t!("keys/dennis-simon-anton-private.pgp"),
+ t!("keys/dsa2048-elgamal3072-private.pgp"),
+ t!("keys/emmelie-dorothea-dina-samantha-awina-ed25519-private.pgp"),
+ t!("keys/erika-corinna-daniela-simone-antonia-nistp256-private.pgp"),
+ t!("keys/erika-corinna-daniela-simone-antonia-nistp384-private.pgp"),
+ t!("keys/erika-corinna-daniela-simone-antonia-nistp521-private.pgp"),
+ t!("keys/testy-new-private.pgp"),
+ t!("keys/testy-nistp256-private.pgp"),
+ t!("keys/testy-nistp384-private.pgp"),
+ t!("keys/testy-nistp521-private.pgp"),
+ t!("keys/testy-private.pgp"),
+];