mirror of
https://github.com/LukasKalbertodt/programmieren-in-rust.git
synced 2024-11-18 02:48:58 +01:00
37 lines
622 B
Rust
Executable File
37 lines
622 B
Rust
Executable File
//! Aufgabe 2.1: Primzahltest
|
|
|
|
fn main() {
|
|
|
|
}
|
|
|
|
#[test]
|
|
fn small_primes() {
|
|
assert!(is_prime(2));
|
|
assert!(is_prime(3));
|
|
assert!(is_prime(5));
|
|
assert!(is_prime(7));
|
|
}
|
|
|
|
#[test]
|
|
fn small_composites() {
|
|
assert!(!is_prime(1));
|
|
assert!(!is_prime(4));
|
|
assert!(!is_prime(6));
|
|
assert!(!is_prime(8));
|
|
assert!(!is_prime(9));
|
|
}
|
|
|
|
#[test]
|
|
fn large_primes() {
|
|
assert!(is_prime(1_300_769));
|
|
assert!(is_prime(1_300_297));
|
|
assert!(is_prime(7_367_287));
|
|
}
|
|
|
|
#[test]
|
|
fn large_composites() {
|
|
assert!(!is_prime(908_209));
|
|
assert!(!is_prime(3_073_009));
|
|
assert!(!is_prime(4_897_369));
|
|
}
|