Skip to content

Commit

Permalink
Rename test_roundtrip_serialization for clarity.
Browse files Browse the repository at this point in the history
  • Loading branch information
AureliaDolo committed Jun 7, 2024
1 parent 8652a04 commit d6f1e61
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use libparsec_types::{DateTime, ShamirRevealToken};

use super::authenticated_cmds;

macro_rules! test_de_serialization {
macro_rules! test_roundtrip_serialization {
($encoded:literal, $expected:path, $load:path) => {
let raw = hex!($encoded);
let data = $load(&raw).unwrap();
Expand Down Expand Up @@ -39,7 +39,7 @@ pub fn rep_shamir_setup_already_exists() {
// Generated from Rust implementation (Parsec v3.0.0-b.6+dev 2024-06-06)
// Content:
// "status": "shamir_setup_already_exist"
test_de_serialization!(
test_roundtrip_serialization!(
"81a6737461747573bb7368616d69725f73657475705f616c72656164795f6578697374 \
73",
authenticated_cmds::shamir_recovery_setup::Rep::ShamirSetupAlreadyExists,
Expand All @@ -51,7 +51,7 @@ pub fn rep_brief_invalid_data() {
// Generated from Rust implementation (Parsec v3.0.0-b.6+dev 2024-06-06)
// Content:
// "status": "brief_invalid_data"
test_de_serialization!(
test_roundtrip_serialization!(
"81a6737461747573b262726965665f696e76616c69645f64617461",
authenticated_cmds::shamir_recovery_setup::Rep::BriefInvalidData,
authenticated_cmds::shamir_recovery_setup::Rep::load
Expand All @@ -61,7 +61,7 @@ pub fn rep_share_invalid_data() {
// Generated from Rust implementation (Parsec v3.0.0-b.6+dev 2024-06-06)
// Content:
// "status": "share_invalid_data"
test_de_serialization!(
test_roundtrip_serialization!(
"81a6737461747573b273686172655f696e76616c69645f64617461",
authenticated_cmds::shamir_recovery_setup::Rep::ShareInvalidData,
authenticated_cmds::shamir_recovery_setup::Rep::load
Expand All @@ -71,7 +71,7 @@ pub fn rep_invalid_recipient() {
// Generated from Rust implementation (Parsec v3.0.0-b.6+dev 2024-06-06)
// Content:
// "status": "invalid_recipient"
test_de_serialization!(
test_roundtrip_serialization!(
"81a6737461747573b1696e76616c69645f726563697069656e74",
authenticated_cmds::shamir_recovery_setup::Rep::InvalidRecipient,
authenticated_cmds::shamir_recovery_setup::Rep::load
Expand All @@ -81,7 +81,7 @@ pub fn rep_share_recipient_not_in_brief() {
// Generated from Rust implementation (Parsec v3.0.0-b.6+dev 2024-06-06)
// Content:
// "status": "share_recipient_not_in_brief"
test_de_serialization!(
test_roundtrip_serialization!(
"81a6737461747573bc73686172655f726563697069656e745f6e6f745f696e5f627269 \
6566",
authenticated_cmds::shamir_recovery_setup::Rep::ShareRecipientNotInBrief,
Expand All @@ -92,7 +92,7 @@ pub fn rep_duplicate_share_for_recipient() {
// Generated from Rust implementation (Parsec v3.0.0-b.6+dev 2024-06-06)
// Content:
// "status": "duplicate_share_for_recipient"
test_de_serialization!(
test_roundtrip_serialization!(
"81a6737461747573bd6475706c69636174655f73686172655f666f725f726563697069 \
656e74",
authenticated_cmds::shamir_recovery_setup::Rep::DuplicateShareForRecipient,
Expand All @@ -103,7 +103,7 @@ pub fn rep_author_included_as_recipient() {
// Generated from Rust implementation (Parsec v3.0.0-b.6+dev 2024-06-06)
// Content:
// "status": "author_included_as_recipient"
test_de_serialization!(
test_roundtrip_serialization!(
"81a6737461747573bc617574686f725f696e636c756465645f61735f72656369706965 \
6e74",
authenticated_cmds::shamir_recovery_setup::Rep::AuthorIncludedAsRecipient,
Expand All @@ -114,7 +114,7 @@ pub fn rep_missing_share_for_recipient() {
// Generated from Rust implementation (Parsec v3.0.0-b.6+dev 2024-06-06)
// Content:
// "status": "missing_share_for_recipient"
test_de_serialization!(
test_roundtrip_serialization!(
"81a6737461747573bb6d697373696e675f73686172655f666f725f726563697069656e \
74",
authenticated_cmds::shamir_recovery_setup::Rep::MissingShareForRecipient,
Expand All @@ -125,7 +125,7 @@ pub fn rep_threshold_greater_than_total_shares() {
// Generated from Rust implementation (Parsec v3.0.0-b.6+dev 2024-06-06)
// Content:
// "status": "threshold_greater_than_total_shares"
test_de_serialization!(
test_roundtrip_serialization!(
"81a6737461747573d9237468726573686f6c645f677265617465725f7468616e5f746f \
74616c5f736861726573",
authenticated_cmds::shamir_recovery_setup::Rep::ThresholdGreaterThanTotalShares,
Expand All @@ -148,7 +148,7 @@ pub fn rep_timestamp_out_of_ballpark() {
client_timestamp: dt,
server_timestamp: dt,
};
test_de_serialization!(
test_roundtrip_serialization!(
"85a6737461747573b974696d657374616d705f6f75745f6f665f62616c6c7061726bbc \
62616c6c7061726b5f636c69656e745f6561726c795f6f6666736574cb404000000000 \
0000bb62616c6c7061726b5f636c69656e745f6c6174655f6f6666736574cb40400000 \
Expand All @@ -167,7 +167,7 @@ pub fn rep_require_greater_timestamp() {
let req = authenticated_cmds::shamir_recovery_setup::Rep::RequireGreaterTimestamp {
strictly_greater_than: DateTime::from_f64_with_us_precision(1234567890.),
};
test_de_serialization!(
test_roundtrip_serialization!(
"82a6737461747573b9726571756972655f677265617465725f74696d657374616d70b5 \
7374726963746c795f677265617465725f7468616ed70141d26580b4800000",
req,
Expand All @@ -179,7 +179,7 @@ pub fn rep_ok() {
// Generated from Rust implementation (Parsec v3.0.0-b.6+dev 2024-05-29)
// Content:
// "status": "ok"
test_de_serialization!(
test_roundtrip_serialization!(
"81a6737461747573a26f6b",
authenticated_cmds::shamir_recovery_setup::Rep::Ok,
authenticated_cmds::shamir_recovery_setup::Rep::load
Expand Down

0 comments on commit d6f1e61

Please sign in to comment.