Add a quick test to ensure that our GCD algorithm works.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user