tracks/haskell/exercises/leap/test/Tests.hs in trackler-2.1.0.11 vs tracks/haskell/exercises/leap/test/Tests.hs in trackler-2.1.0.12
- old
+ new
@@ -9,12 +9,11 @@
main :: IO ()
main = hspecWith defaultConfig {configFastFail = True} specs
specs :: Spec
-specs = describe "leap" $
- describe "isLeapYear" $ for_ cases test
+specs = describe "isLeapYear" $ for_ cases test
where
test Case{..} = it explanation assertion
where
explanation = unwords [show input, "-", description]
@@ -24,34 +23,22 @@
, input :: Integer
, expected :: Bool
}
cases :: [Case]
-cases = [ Case { description = "leap year"
- , input = 1996
- , expected = True
- }
- , Case { description = "standard and odd year"
- , input = 1997
+cases = [ Case { description = "year not divisible by 4: common year"
+ , input = 2015
, expected = False
}
- , Case { description = "standard even year"
- , input = 1998
- , expected = False
+ , Case { description = "year divisible by 4, not divisible by 100: leap year"
+ , input = 2016
+ , expected = True
}
- , Case { description = "standard nineteenth century"
- , input = 1900
+ , Case { description = "year divisible by 100, not divisible by 400: common year"
+ , input = 2100
, expected = False
}
- , Case { description = "standard eighteenth century"
- , input = 1800
- , expected = False
- }
- , Case { description = "leap twenty fourth century"
- , input = 2400
- , expected = True
- }
- , Case { description = "leap y2k"
+ , Case { description = "year divisible by 400: leap year"
, input = 2000
, expected = True
}
]