From b1c659087d75e51a82d53885085de11f6c9c7016 Mon Sep 17 00:00:00 2001 From: Adam Wick Date: Sat, 14 Apr 2018 07:01:59 -0700 Subject: [PATCH] Add a quick test to ensure that our GCD algorithm works. --- src/cryptonum/signed.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cryptonum/signed.rs b/src/cryptonum/signed.rs index ac2b022..ede567f 100644 --- a/src/cryptonum/signed.rs +++ b/src/cryptonum/signed.rs @@ -8,7 +8,7 @@ use std::ops::*; #[derive(Clone,Debug,PartialEq,Eq)] pub struct SCN { negative: bool, - value: UCN + pub(crate) value: UCN } impl SCN { @@ -308,4 +308,11 @@ mod test { (- (&a + &b)) == ((- &a) + (- &b)) } } + + quickcheck! { + fn egcd_works(a: SCN, b: SCN) -> bool { + let (d, x, y) = a.clone().egcd(b.clone()); + ((a * x) + (b * y)) == d + } + } }