Skip to content

Commit

Permalink
test: add prime test case
Browse files Browse the repository at this point in the history
Based on the example in #50

Fixes #50
  • Loading branch information
dignifiedquire committed Jun 27, 2023
1 parent ed4be5a commit 5fb32eb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/prime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ mod tests {
}

#[test]
fn test_next_prime() {
fn test_next_prime_basics() {
let primes1 = (0..2048u32)
.map(|i| next_prime(&i.to_biguint().unwrap()))
.collect::<Vec<_>>();
Expand All @@ -651,4 +651,11 @@ mod tests {
assert!(probably_prime(p1, 25));
}
}

#[test]
fn test_next_prime_bug_44() {
let i = 1032989.to_biguint().unwrap();
let next = next_prime(&i);
assert_eq!(1033001.to_biguint().unwrap(), next);
}
}

0 comments on commit 5fb32eb

Please sign in to comment.