on master help sign in
update chooseInt with choose restricted to Int
f67df51Ahmed Zaheer Dadarkar
test/Streamly/Test/Internal/Data/Parser.hs+5−2
@@ -8,7 +8,7 @@ import qualified Streamly.Internal.Data.Fold as FL
8
8
9import Test.Hspec(hspec, describe)
9import Test.Hspec(hspec, describe)
10import Test.Hspec.QuickCheck
10import Test.Hspec.QuickCheck
11−import Test.QuickCheck (forAll, chooseInt, Property, property, listOf, vectorOf, counterexample, (.&&.))
11+import Test.QuickCheck (forAll, choose, Property, property, listOf, vectorOf, counterexample, (.&&.), Gen)
12
12
13import Test.QuickCheck.Monadic (monadicIO, PropertyM, assert, monitor)
13import Test.QuickCheck.Monadic (monadicIO, PropertyM, assert, monitor)
14import Control.Monad.IO.Class (MonadIO(..))
14import Control.Monad.IO.Class (MonadIO(..))
@@ -48,6 +48,9 @@ listEquals eq parsed_list list = do
48checkListEqual :: (Show a, Eq a) => [a] -> [a] -> Property
48checkListEqual :: (Show a, Eq a) => [a] -> [a] -> Property
49checkListEqual ls_1 ls_2 = monadicIO (listEquals (==) ls_1 ls_2)
49checkListEqual ls_1 ls_2 = monadicIO (listEquals (==) ls_1 ls_2)
50
50
51+chooseInt :: (Int, Int) -> Gen Int
52+chooseInt = choose
53+
51-- Accumulator Tests
54-- Accumulator Tests
52
55
53fromFold :: Property
56fromFold :: Property
@@ -434,7 +437,7 @@ main = hspec $ do
434 prop "P.takeGE n ls = ls when len >= n" takeGEPass
437 prop "P.takeGE n ls = ls when len >= n" takeGEPass
435 prop "P.takeGE n ls = ls when len >= n and fail otherwise" Main.takeGE
438 prop "P.takeGE n ls = ls when len >= n and fail otherwise" Main.takeGE
436 prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n" lookAheadPass
439 prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n" lookAheadPass
437− prop "exceed the length of stream" lookAheadFail
440+ prop "Fail when stream length exceeded" lookAheadFail
438 prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n, else fail" lookAhead
441 prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n, else fail" lookAhead
439 prop "P.takeWhile = Prelude.takeWhile" Main.takeWhile
442 prop "P.takeWhile = Prelude.takeWhile" Main.takeWhile
440 prop "P.takeWhile = Prelude.takeWhile if taken something, else check why failed" takeWhile1
443 prop "P.takeWhile = Prelude.takeWhile if taken something, else check why failed" takeWhile1