From 6c33c3a5ba7e077e17b34c06d21d3065d547b195 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Thu, 17 Oct 2019 22:50:38 -0700 Subject: [PATCH] Update shred tests to use specific error codes (#6428) automerge --- core/src/shred.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/core/src/shred.rs b/core/src/shred.rs index f7f49167fe..37c08aa142 100644 --- a/core/src/shred.rs +++ b/core/src/shred.rs @@ -742,13 +742,19 @@ pub mod tests { // Test that parent cannot be > current slot assert_matches!( - Shredder::new(slot, slot + 1, 1.001, keypair.clone()), - Err(_) + Shredder::new(slot, slot + 1, 1.00, keypair.clone()), + Err(ShredError::SlotTooLow { + slot: _, + parent_slot: _, + }) ); // Test that slot - parent cannot be > u16 MAX assert_matches!( - Shredder::new(slot, slot - 1 - 0xffff, 1.001, keypair.clone()), - Err(_) + Shredder::new(slot, slot - 1 - 0xffff, 1.00, keypair.clone()), + Err(ShredError::SlotTooLow { + slot: _, + parent_slot: _, + }) ); let fec_rate = 0.25; @@ -856,7 +862,7 @@ pub mod tests { // Test that FEC rate cannot be > 1.0 assert_matches!( Shredder::new(slot, slot - 5, 1.001, keypair.clone()), - Err(_) + Err(ShredError::InvalidFecRate(_)) ); let shredder = Shredder::new(0x123456789abcdef0, slot - 5, 1.0, keypair.clone())