Skip to content

Commit 7a1e600

Browse files
committed
Add documentation to README
1 parent 4d3b931 commit 7a1e600

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
11
# Hspec Codewars
22

33
Utility 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.

0 commit comments

Comments
 (0)