Utility functions for testing on Codewars with Hspec.
Hidden
data Hidden
-- | Module to be hidden
= Module {moduleName :: String}
-- | Symbol from a module to be hidden
| FromModule {moduleName :: String, symbolName :: String}
solutionShouldHide :: Hidden -> Expectation
Check that solution hides a module or a symbol from a module.
solutionShouldHide $ FromModule "Prelude" "head"
solutionShouldHideAll :: [Hidden] -> Expectation
Check that solution hides all of given modules and symbols.
solutionShouldHideAll [FromModule "Prelude" "head", Module "Data.Set"]
shouldBeApprox :: (Fractional a, Ord a, Show a) => a -> a -> Expectation
Predefined approximately equal expectation with error margin 1e-6
.
sqrt 2.0 `shouldBeApprox` (1.4142135 :: Double)
shouldBeApproxPrec :: (Fractional a, Ord a, Show a) => a -> a -> a -> Expectation
Create approximately equal expectation with margin.
shouldBeApprox' = shouldBeApproxPrec 1e-9