Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.86 KB

Leapyear.md

File metadata and controls

46 lines (34 loc) · 1.86 KB

#Kata: Leap Year #

Introduction

A leap year (or intercalary or bissextile year) is a year containing one additional day (or, in the case of lunisolar calendars, a month) in order to keep the calendar year synchronized with the astronomical or seasonal year.

--Wikipedia (Leap year)

Rules

A leap year is:

  1. divisible by 4

  2. not divisible by 100, unless it is also divisible by 400.

##Test Cases ##

  1. LeapYear_returns_true_for_1904()
  2. LeapYear_returns_true_for_1952()
  3. LeapYear_returns_true_for_2000()
  4. LeapYear_returns_true_for_2012()
  5. LeapYear_returns_true_for_2048()
  6. LeapYear_returns_true_for_2096()
  7. LeapYear_returns_false_for_1700()
  8. LeapYear_returns_false_for_1900()
  9. LeapYear_returns_false_for_2100()
  10. LeapYear_returns_false_for_2001()
  11. LeapYear_returns_false_for_2014()
  12. LeapYear_returns_false_for_2050()

Extra Credit

B.C. and 1st Century A.D. Leap Years did not follow the pattern above. Extend your LeapYear.IsLeapYear(int) method to correctly identify these Leap Years using the details below. Use negative numbers to indicate BCE years.

The leap year was introduced in the Julian calendar in 46 BC. However, around 10 BC, it was found that the priests in charge of computing the calendar had been adding leap years every three years instead of the four decreed by Caesar (Vardi 1991, p. 239). As a result of this error, no more leap years were added until 8 AD.

--Eric Weisstein's World of Astronomy

###Extra Credit Test Cases###

  1. LeapYear_returns_false_for_4AD()
  2. LeapYear_returns_false_for_0AD()
  3. LeapYear_returns_false_for_50BC()
  4. LeapYear_returns_true_for_8AD()
  5. LeapYear_returns_true_for_30BC()
  6. LeapYear_returns_true_for_45BC()