File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 11# Hspec Codewars
22
33Utility functions for testing on Codewars with Hspec.
4+
5+ ## Functions
6+
7+ ### Blacklisting
8+
9+ ``` haskell
10+ solutionShouldHide :: Hidden -> Expectation
11+
12+ -- solutionShouldHide $ FromModule "Prelude" "head"
13+ ```
14+ Check that solution hides a module or a symbol from a module.
15+
16+ ``` haskell
17+ solutionShouldHideAll :: [Hidden ] -> Expectation
18+
19+ -- solutionShouldHideAll [FromModule "Prelude" "head", Module "Data.Set"]
20+ ```
21+ Check that solution hides all of given modules and symbols.
22+
23+ ### Approximate Equality
24+
25+ ``` haskell
26+ shouldBeApprox :: (Fractional a , Ord a , Show a ) => a -> a -> Expectation
27+
28+ -- sqrt 2.0 `shouldBeApprox` (1.4142135 :: Double)
29+ ```
30+ Predefined approximately equal expectation with error margin ` 1e-6 ` .
31+
32+ ``` haskell
33+ shouldBeApproxPrec :: (Fractional a , Ord a , Show a ) => a -> a -> a -> Expectation
34+
35+ -- shouldBeApprox' = shouldBeApproxPrec 1e-9
36+ ```
37+ Create approximately equal expectation with margin.
You can’t perform that action at this time.
0 commit comments