summary refs log tree commit diff stats
path: root/tests/stdlib
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2017-10-16 15:40:29 +0100
committerGitHub <noreply@github.com>2017-10-16 15:40:29 +0100
commit955b48cf15ce41f8c47010db0064da8668ed02c0 (patch)
tree37dd2bd2c8ee18f961720ac42eb0276fd0b764bc /tests/stdlib
parent54c805921a5a02806e4df4adb6fad4b8d33a448d (diff)
parentf2ba3d174c3e6b65d5785d1e621ce702c4bc36e1 (diff)
downloadNim-955b48cf15ce41f8c47010db0064da8668ed02c0.tar.gz
Merge pull request #6495 from GULPF/Fix-countLeapYears
Fix countLeapYears
Diffstat (limited to 'tests/stdlib')
-rw-r--r--tests/stdlib/ttimes.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/stdlib/ttimes.nim b/tests/stdlib/ttimes.nim
index 05c91ccb2..84e00f8de 100644
--- a/tests/stdlib/ttimes.nim
+++ b/tests/stdlib/ttimes.nim
@@ -235,3 +235,9 @@ block dstTest:
     parsedJul = parse("2016-07-01 04:00:00+01:00", "yyyy-MM-dd HH:mm:sszzz")
   doAssert toTime(parsedJan) == fromSeconds(1451962800)
   doAssert toTime(parsedJul) == fromSeconds(1467342000)
+
+block countLeapYears:
+  # 1920, 2004 and 2020 are leap years, and should be counted starting at the following year
+  doAssert countLeapYears(1920) + 1 == countLeapYears(1921)
+  doAssert countLeapYears(2004) + 1 == countLeapYears(2005)
+  doAssert countLeapYears(2020) + 1 == countLeapYears(2021)
\ No newline at end of file