@@ -8,7 +8,7 @@ import qualified Streamly.Internal.Data.Fold as FL
88
99import Test.Hspec(hspec, describe)
1010import Test.Hspec.QuickCheck
11−import Test.QuickCheck (forAll, choose, Property, property, listOf, vectorOf, counterexample, (.&&.), Gen)
11+import Test.QuickCheck (forAll, choose, Property, property, listOf, vectorOf, counterexample, Gen)
1212
1313import Test.QuickCheck.Monadic (monadicIO, PropertyM, assert, monitor)
1414import Control.Monad.IO.Class (MonadIO(..))
@@ -217,54 +217,54 @@ takeGE =
217217 property False
218218 Left _ -> property (n > list_length)
219219
220−lookAheadPass :: Property
221−lookAheadPass =
222− forAll (chooseInt (min_value + 1, max_value)) $ \n ->
223− let
224− takeWithoutConsume = P.lookAhead $ P.take n FL.toList
225− parseTwice = do
226− parsed_list_1 <- takeWithoutConsume
227− parsed_list_2 <- takeWithoutConsume
228− return (parsed_list_1, parsed_list_2)
229− in
230− forAll (chooseInt (n, max_value)) $ \list_length ->
231− forAll (vectorOf list_length (chooseInt (min_value, max_value))) $ \ls ->
232− case S.parse parseTwice (S.fromList ls) of
233− Right (ls_1, ls_2) -> checkListEqual ls_1 ls_2 .&&. checkListEqual ls_1 (Prelude.take n ls)
234− Left _ -> property $ False
235−
236−lookAheadFail :: Property
237−lookAheadFail =
238− forAll (chooseInt (min_value + 1, max_value)) $ \n ->
239− let
240− takeWithoutConsume = P.lookAhead $ P.take n FL.toList
241− parseTwice = do
242− parsed_list_1 <- takeWithoutConsume
243− parsed_list_2 <- takeWithoutConsume
244− return (parsed_list_1, parsed_list_2)
245− in
246− forAll (chooseInt (min_value, n - 1)) $ \list_length ->
247− forAll (vectorOf list_length (chooseInt (min_value, max_value))) $ \ls ->
248− case S.parse parseTwice (S.fromList ls) of
249− Right _ -> False
250− Left _ -> True
251−
252−lookAhead :: Property
253−lookAhead =
254− forAll (chooseInt (min_value, max_value)) $ \n ->
255− let
256− takeWithoutConsume = P.lookAhead $ P.take n FL.toList
257− parseTwice = do
258− parsed_list_1 <- takeWithoutConsume
259− parsed_list_2 <- takeWithoutConsume
260− return (parsed_list_1, parsed_list_2)
261− in
262− forAll (listOf (chooseInt (min_value, max_value))) $ \ls ->
263− case S.parse parseTwice (S.fromList ls) of
264− Right (ls_1, ls_2) -> checkListEqual ls_1 ls_2 .&&. checkListEqual ls_1 (Prelude.take n ls)
265− Left _ -> property ((list_length < n) || (list_length == n && n == 0))
266− where
267− list_length = Prelude.length ls
220+-- lookAheadPass :: Property
221+-- lookAheadPass =
222+-- forAll (chooseInt (min_value + 1, max_value)) $ \n ->
223+-- let
224+-- takeWithoutConsume = P.lookAhead $ P.take n FL.toList
225+-- parseTwice = do
226+-- parsed_list_1 <- takeWithoutConsume
227+-- parsed_list_2 <- takeWithoutConsume
228+-- return (parsed_list_1, parsed_list_2)
229+-- in
230+-- forAll (chooseInt (n, max_value)) $ \list_length ->
231+-- forAll (vectorOf list_length (chooseInt (min_value, max_value))) $ \ls ->
232+-- case S.parse parseTwice (S.fromList ls) of
233+-- Right (ls_1, ls_2) -> checkListEqual ls_1 ls_2 .&&. checkListEqual ls_1 (Prelude.take n ls)
234+-- Left _ -> property $ False
235+
236+-- lookAheadFail :: Property
237+-- lookAheadFail =
238+-- forAll (chooseInt (min_value + 1, max_value)) $ \n ->
239+-- let
240+-- takeWithoutConsume = P.lookAhead $ P.take n FL.toList
241+-- parseTwice = do
242+-- parsed_list_1 <- takeWithoutConsume
243+-- parsed_list_2 <- takeWithoutConsume
244+-- return (parsed_list_1, parsed_list_2)
245+-- in
246+-- forAll (chooseInt (min_value, n - 1)) $ \list_length ->
247+-- forAll (vectorOf list_length (chooseInt (min_value, max_value))) $ \ls ->
248+-- case S.parse parseTwice (S.fromList ls) of
249+-- Right _ -> False
250+-- Left _ -> True
251+
252+-- lookAhead :: Property
253+-- lookAhead =
254+-- forAll (chooseInt (min_value, max_value)) $ \n ->
255+-- let
256+-- takeWithoutConsume = P.lookAhead $ P.take n FL.toList
257+-- parseTwice = do
258+-- parsed_list_1 <- takeWithoutConsume
259+-- parsed_list_2 <- takeWithoutConsume
260+-- return (parsed_list_1, parsed_list_2)
261+-- in
262+-- forAll (listOf (chooseInt (min_value, max_value))) $ \ls ->
263+-- case S.parse parseTwice (S.fromList ls) of
264+-- Right (ls_1, ls_2) -> checkListEqual ls_1 ls_2 .&&. checkListEqual ls_1 (Prelude.take n ls)
265+-- Left _ -> property ((list_length < n) || (list_length == n && n == 0))
266+-- where
267+-- list_length = Prelude.length ls
268268
269269takeWhile :: Property
270270takeWhile =
@@ -436,9 +436,9 @@ main = hspec $ do
436436 prop "P.takeEQ = Prelude.take when len >= n and fail otherwise" Main.takeEQ
437437 prop "P.takeGE n ls = ls when len >= n" takeGEPass
438438 prop "P.takeGE n ls = ls when len >= n and fail otherwise" Main.takeGE
439− prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n" lookAheadPass
440− prop "Fail when stream length exceeded" lookAheadFail
441− prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n, else fail" lookAhead
439+ -- prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n" lookAheadPass
440+ -- prop "Fail when stream length exceeded" lookAheadFail
441+ -- prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n, else fail" lookAhead
442442 prop "P.takeWhile = Prelude.takeWhile" Main.takeWhile
443443 prop "P.takeWhile = Prelude.takeWhile if taken something, else check why failed" takeWhile1
444444 prop "P.sliceSepBy = Prelude.takeWhile (not . predicate)" sliceSepBy