fix: Make all polynomials monic in task fn

This commit is contained in:
Alivecow 2024-11-23 13:33:51 +01:00
parent 2e73125e14
commit 69a2026c84
2 changed files with 16 additions and 2 deletions

View file

@ -1267,7 +1267,7 @@ mod tests {
assert_eq!(json!(result.to_c_array()), expected);
}
#[test]
fn test_poly_gcd() {
let a = json!([
@ -1304,4 +1304,18 @@ mod tests {
assert_eq!(json!(result.to_c_array()), expected);
}
#[test]
fn test_poly_gcd_zero() {
let a = json!(["AAAAAAAAAAAAAAAAAAAAAA==",]);
let b = json!(["AAAAAAAAAAAAAAAAAAAAAA=="]);
let expected = json!(["AAAAAAAAAAAAAAAAAAAAAA=="]);
let a: Polynomial = Polynomial::from_c_array(&a);
let b: Polynomial = Polynomial::from_c_array(&b);
let result = gcd(a.monic(), b.monic());
assert_eq!(json!(result.to_c_array()), expected);
}
}