Lines effect
This commit is contained in:
parent
db0f3a0427
commit
bd94410c01
13 changed files with 146 additions and 27 deletions
28
test/hedgehog/001-lines/Main.idr
Normal file
28
test/hedgehog/001-lines/Main.idr
Normal file
|
@ -0,0 +1,28 @@
|
|||
module Main
|
||||
|
||||
import SSG.Djot.Lines
|
||||
|
||||
import Control.Eff
|
||||
import Data.String
|
||||
import Hedgehog
|
||||
|
||||
lines' : Eff [Lines] (List String)
|
||||
lines' = do
|
||||
Just next <- take
|
||||
| _ => pure []
|
||||
map (next ::) lines'
|
||||
|
||||
propLinesEquiv : Property
|
||||
propLinesEquiv = property $ do
|
||||
str <- forAll $ string (linear 0 256) ascii
|
||||
let std_lines = lines str
|
||||
let (our_lines, rest) = extract $ runLines str lines'
|
||||
our_lines === std_lines
|
||||
|
||||
main : IO ()
|
||||
main = test $
|
||||
[ MkGroup
|
||||
"Lines effect"
|
||||
[ ("Lines effect equivalent to lines", propLinesEquiv)
|
||||
]
|
||||
]
|
3
test/hedgehog/001-lines/expected
Normal file
3
test/hedgehog/001-lines/expected
Normal file
|
@ -0,0 +1,3 @@
|
|||
━━━ Lines effect ━━━
|
||||
✓ Lines effect equivalent to lines passed 1000 tests.
|
||||
✓ 1 succeeded.
|
5
test/hedgehog/001-lines/pack.toml
Normal file
5
test/hedgehog/001-lines/pack.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
[custom.all.SSG]
|
||||
type = "local"
|
||||
path = "../../.."
|
||||
ipkg = "SSG.ipkg"
|
||||
test = "test/test.ipkg"
|
6
test/hedgehog/001-lines/run
Normal file
6
test/hedgehog/001-lines/run
Normal file
|
@ -0,0 +1,6 @@
|
|||
rm -rf build/
|
||||
|
||||
flock "$1" pack -q install-deps test.ipkg
|
||||
HEDGEHOG_COLOR=0 pack -q run test.ipkg -n 1000
|
||||
|
||||
rm -rf build/
|
9
test/hedgehog/001-lines/test.ipkg
Normal file
9
test/hedgehog/001-lines/test.ipkg
Normal file
|
@ -0,0 +1,9 @@
|
|||
package a-test
|
||||
|
||||
depends = SSG
|
||||
, hedgehog
|
||||
, eff
|
||||
|
||||
main = Main
|
||||
|
||||
executable = test
|
Loading…
Add table
Add a link
Reference in a new issue