mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 04:27:45 +00:00
tests ~ (sub-crate/factor) fix divisor(0,0)
test of factor::numeric::gcd() with early value check and return (fixes #1587)
This commit is contained in:
parent
63315747a5
commit
2a50dc42c1
1 changed files with 1 additions and 0 deletions
|
@ -75,6 +75,7 @@ mod tests {
|
|||
fn divisor(a: u64, b: u64) -> bool {
|
||||
// Test that gcd(a, b) divides a and b
|
||||
let g = gcd(a, b);
|
||||
if g == 0 { return a == 0 && b == 0; }
|
||||
a % g == 0 && b % g == 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue