summaryrefslogtreecommitdiff
path: root/rust/leap/tests/leap.rs
diff options
context:
space:
mode:
authorDimitri Sokolyuk <sokolyuk@gmail.com>2024-07-17 21:36:17 +0200
committerDimitri Sokolyuk <sokolyuk@gmail.com>2024-07-17 21:36:17 +0200
commit431a0b397afaa132473fd1f4c0197dd1c1cb7d9c (patch)
tree6be89729e01db607f4e431750899bfcddf71b3c3 /rust/leap/tests/leap.rs
parentc6178ed800c5aadd9da2063ff7d68e36db9b64e5 (diff)
Add leap yearHEADmaster
Diffstat (limited to 'rust/leap/tests/leap.rs')
-rw-r--r--rust/leap/tests/leap.rs54
1 files changed, 54 insertions, 0 deletions
diff --git a/rust/leap/tests/leap.rs b/rust/leap/tests/leap.rs
new file mode 100644
index 0000000..371f27e
--- /dev/null
+++ b/rust/leap/tests/leap.rs
@@ -0,0 +1,54 @@
+use leap::*;
+
+#[test]
+fn year_not_divisible_by_4_in_common_year() {
+ assert!(!is_leap_year(2015));
+}
+
+#[test]
+#[ignore]
+fn year_divisible_by_2_not_divisible_by_4_in_common_year() {
+ assert!(!is_leap_year(1970));
+}
+
+#[test]
+#[ignore]
+fn year_divisible_by_4_not_divisible_by_100_in_leap_year() {
+ assert!(is_leap_year(1996));
+}
+
+#[test]
+#[ignore]
+fn year_divisible_by_4_and_5_is_still_a_leap_year() {
+ assert!(is_leap_year(1960));
+}
+
+#[test]
+#[ignore]
+fn year_divisible_by_100_not_divisible_by_400_in_common_year() {
+ assert!(!is_leap_year(2100));
+}
+
+#[test]
+#[ignore]
+fn year_divisible_by_100_but_not_by_3_is_still_not_a_leap_year() {
+ assert!(!is_leap_year(1900));
+}
+
+#[test]
+#[ignore]
+fn year_divisible_by_400_is_leap_year() {
+ assert!(is_leap_year(2000));
+}
+
+#[test]
+#[ignore]
+fn year_divisible_by_400_but_not_by_125_is_still_a_leap_year() {
+ assert!(is_leap_year(2400));
+}
+
+#[test]
+#[ignore]
+fn year_divisible_by_200_not_divisible_by_400_in_common_year() {
+ assert!(!is_leap_year(1800));
+}