leap
This commit is contained in:
parent
9ea786eda5
commit
418484b415
7 changed files with 267 additions and 0 deletions
46
rust/leap/tests/leap.rs
Normal file
46
rust/leap/tests/leap.rs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
use leap::*;
|
||||
|
||||
#[test]
|
||||
fn year_not_divisible_by_4_in_common_year() {
|
||||
assert!(!is_leap_year(2015));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn year_divisible_by_2_not_divisible_by_4_in_common_year() {
|
||||
assert!(!is_leap_year(1970));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn year_divisible_by_4_not_divisible_by_100_in_leap_year() {
|
||||
assert!(is_leap_year(1996));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn year_divisible_by_4_and_5_is_still_a_leap_year() {
|
||||
assert!(is_leap_year(1960));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn year_divisible_by_100_not_divisible_by_400_in_common_year() {
|
||||
assert!(!is_leap_year(2100));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn year_divisible_by_100_but_not_by_3_is_still_not_a_leap_year() {
|
||||
assert!(!is_leap_year(1900));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn year_divisible_by_400_is_leap_year() {
|
||||
assert!(is_leap_year(2000));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn year_divisible_by_400_but_not_by_125_is_still_a_leap_year() {
|
||||
assert!(is_leap_year(2400));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn year_divisible_by_200_not_divisible_by_400_in_common_year() {
|
||||
assert!(!is_leap_year(1800));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue