This site is supported by donations to The OEIS Foundation.

Template:Ifleapyear/test

From OeisWiki
Jump to: navigation, search
This is the test page of the {{ifleapyear}} date and time if-then-else function template.

Test

Examples with valid input

code result
{{ifleapyear}} 1
{{ifleapyear|2=leap year|3=common year}} leap year
{{ifleapyear|1|leap year|common year}} common year
{{ifleapyear|4|leap year|common year}} common year
{{ifleapyear|10.00|leap year|common year}} common year
{{ifleapyear|1700|leap year|common year}} common year
{{ifleapyear|1900|leap year|common year}} common year


code result
{{ifleapyear|8}} 1
{{ifleapyear|8|leap year|common year}} leap year
{{ifleapyear|12|leap year|common year}} leap year
{{ifleapyear|400|leap year|common year}} leap year
{{ifleapyear|500|leap year|common year}} leap year
{{ifleapyear|504|leap year|common year}} leap year
{{ifleapyear|+1000|leap year|common year}} leap year
{{ifleapyear|1580|leap year|common year}} leap year
{{ifleapyear|1600|leap year|common year}} leap year
{{ifleapyear|1704|leap year|common year}} leap year
{{ifleapyear|1960|leap year|common year}} leap year
{{ifleapyear|1904|leap year|common year}} leap year
{{ifleapyear|2000|leap year|common year}} leap year
{{ifleapyear|2012|leap year|common year}} leap year


Examples with invalid input

code result
{{ifleapyear|one}} Ifleapyear error: Year must be a non formatted integer
{{ifleapyear|one|leap year|common year}} Ifleapyear error: Year must be a non formatted integer
{{ifleapyear|99 balloons|leap year|common year}} Ifleapyear error: Year must be a non formatted integer
{{ifleapyear|99.9999e-10|leap year|common year}} Ifleapyear error: Year must be a non formatted integer
{{ifleapyear|1,000.50|leap year|common year}} Ifleapyear error: Year must be a non formatted integer
{{ifleapyear|1,000|leap year|common year}} Ifleapyear error: Year must be a non formatted integer
{{ifleapyear|-34|leap year|common year}} Ifleapyear error: Year must be an integer in [1..10000]
{{ifleapyear|0|leap year|common year}} Ifleapyear error: Year must be an integer in [1..10000]
{{ifleapyear|-0|leap year|common year}} Ifleapyear error: Year must be an integer in [1..10000]
{{ifleapyear|99.9999e10|leap year|common year}} Ifleapyear error: Year must be an integer in [1..10000]
{{ifleapyear|99.9999E10|leap year|common year}} Ifleapyear error: Year must be an integer in [1..10000]
{{ifleapyear|-99.9999e+10|leap year|common year}} Ifleapyear error: Year must be an integer in [1..10000]

Code


{{ifint| {{{1|{{LOCALYEAR}}}}}
<!-- AD years (positive) in [1..10000] only, BC years (negative) not considered, note that there was no year 0.
     Julian calendar from 1 to 1581, Gregorian calendar from 1582 to 10000.  -->
| {{#ifexpr: ( ( {{{1|{{LOCALYEAR}}}}} >= 1 ) and ( {{{1|{{LOCALYEAR}}}}} <= 10000 ) )   
  | {{#ifexpr: ( ( {{{1|{{LOCALYEAR}}}}} mod 4  = 0 ) and ( {{{1|{{LOCALYEAR}}}}} > 4 ) ) 
    <!-- The UNIX command cal incorrectly lists 4 AD as a leap year (Vardi 1991). 
         http://scienceworld.wolfram.com/astronomy/JulianCalendar.html -->
    | {{#ifexpr: ( {{{1|{{LOCALYEAR}}}}} >= 1582 )
      <!-- Gregorian calendar -->      
      | {{#ifexpr: ( {{{1|{{LOCALYEAR}}}}} mod 100 ) = 0      
        | {{#ifexpr: ( {{{1|{{LOCALYEAR}}}}} mod 400 ) = 0
          | {{{2|1}}} <!-- leap year -->
          | {{{3|0}}} <!-- common year -->
          }}
        | {{{2|1}}} <!-- leap year -->
        }}
      <!-- Julian calendar -->
      | {{{2|1}}} <!-- leap year -->     
      }}
    | {{{3|0}}} <!-- common year -->     
    }}
  | {{error|Ifleapyear error: Year must be an integer in [1..10000]}}   
  }}
| {{error|Ifleapyear error: Year must be a non formatted integer}}
}}