Skip to content

Commit 476f6c0

Browse files
authored
Merge pull request #3 from kazk/update-readme-docs
Update documentation
2 parents 039e34c + d47bf40 commit 476f6c0

File tree

1 file changed

+39
-11
lines changed

1 file changed

+39
-11
lines changed

README.md

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,65 @@
1-
# Hspec Codewars
1+
# Test.Hspec.Codewars
22

33
Utility functions for testing on Codewars with Hspec.
44

5-
## Functions
6-
75
### Blacklisting
86

7+
#### `Hidden`
8+
99
```haskell
10-
solutionShouldHide :: Hidden -> Expectation
10+
data Hidden
11+
-- | Module to be hidden
12+
= Module {moduleName :: String}
13+
-- | Symbol from a module to be hidden
14+
| FromModule {moduleName :: String, symbolName :: String}
15+
```
1116

12-
-- solutionShouldHide $ FromModule "Prelude" "head"
17+
#### `solutionShouldHide`
18+
19+
```haskell
20+
solutionShouldHide :: Hidden -> Expectation
1321
```
22+
1423
Check that solution hides a module or a symbol from a module.
1524

1625
```haskell
17-
solutionShouldHideAll :: [Hidden] -> Expectation
26+
solutionShouldHide $ FromModule "Prelude" "head"
27+
```
1828

19-
-- solutionShouldHideAll [FromModule "Prelude" "head", Module "Data.Set"]
29+
#### `solutionShouldHideAll`
30+
31+
```haskell
32+
solutionShouldHideAll :: [Hidden] -> Expectation
2033
```
34+
2135
Check that solution hides all of given modules and symbols.
2236

37+
```haskell
38+
solutionShouldHideAll [FromModule "Prelude" "head", Module "Data.Set"]
39+
```
40+
2341
### Approximate Equality
2442

43+
#### `shouldBeApprox`
44+
2545
```haskell
2646
shouldBeApprox :: (Fractional a, Ord a, Show a) => a -> a -> Expectation
27-
28-
-- sqrt 2.0 `shouldBeApprox` (1.4142135 :: Double)
2947
```
48+
3049
Predefined approximately equal expectation with error margin `1e-6`.
3150

3251
```haskell
33-
shouldBeApproxPrec :: (Fractional a, Ord a, Show a) => a -> a -> a -> Expectation
52+
sqrt 2.0 `shouldBeApprox` (1.4142135 :: Double)
53+
```
3454

35-
-- shouldBeApprox' = shouldBeApproxPrec 1e-9
55+
#### `shouldBeApproxPrec`
56+
57+
```haskell
58+
shouldBeApproxPrec :: (Fractional a, Ord a, Show a) => a -> a -> a -> Expectation
3659
```
60+
3761
Create approximately equal expectation with margin.
62+
63+
```haskell
64+
shouldBeApprox' = shouldBeApproxPrec 1e-9
65+
```

0 commit comments

Comments
 (0)