-- ---------------------------------------------
-- Data.Iteratee.Char

{-
-- this isn't true, since lines "\r" returns ["\r"], and IC.line should
-- return Right "".  Not sure what a real test would be...
prop_line xs = P.length xs > 0 ==>
               fromEither (runner1 (enumPure1Chunk xs $ IC.line))
               == head (lines xs)
  where
  types = xs :: [Char]
  fromEither (Left l)  = l
  fromEither (Right l) = l
-}

-- ---------------------------------------------
tests = [
  testGroup "Elementary" [
    testProperty "list" prop_list
    ,testProperty "chunkList" prop_clist]
  ,testGroup "Stream tests" [
    testProperty "mempty" prop_mempty
    ,testProperty "mappend" prop_mappend
    ,testProperty "mappend associates" prop_mappend2
    ,testProperty "eq" prop_eq
  ]
  ,testGroup "Simple Iteratees" [
    testProperty "break" prop_break
    ,testProperty "break remainder" prop_break2
    ,testProperty "head" prop_head
    ,testProperty "head remainder" prop_head2
    ,testProperty "tryhead" prop_tryhead
    ,testProperty "heads" prop_heads
    ,testProperty "null heads" prop_heads2
    ,testProperty "peek" prop_peek
    ,testProperty "peek2" prop_peek2
    ,testProperty "last" prop_last1
    ,testProperty "last ends properly" prop_last2
    ,testProperty "length" prop_length
    ,testProperty "chunkLength" prop_chunkLength
    ,testProperty "chunkLength of EoF" prop_chunkLength2
    ,testProperty "takeFromChunk" prop_takeFromChunk
    ,testProperty "drop" prop_drop
    ,testProperty "dropWhile" prop_dropWhile
    ,testProperty "skipToEof" prop_skip
    ,testProperty "iteratee Functor 1" prop_iterFmap
    ,testProperty "iteratee Functor 2" prop_iterFmap2
    ,testProperty "iteratee Monad LI" prop_iterMonad1
    ,testProperty "iteratee Monad RI" prop_iterMonad2
    ,testProperty "iteratee Monad Assc" prop_iterMonad3
    ]
  ,testGroup "Simple Enumerators/Combinators" [
    testProperty "enumPureNChunk" prop_enumChunks
    ,testProperty "enum append 1" prop_app1
    ,testProperty "enum sequencing" prop_app2
    ,testProperty "enum sequencing 2" prop_app3
    ,testProperty "enumEof" prop_eof
    ,testProperty "isFinished" prop_isFinished
    ,testProperty "isFinished error" prop_isFinished2
    ,testProperty "null data idempotence" prop_null
    ,testProperty "null data head idempotence" prop_nullH
    ,testProperty "enumList" prop_enumList
    ,testProperty "enumCheckIfDone" prop_enumCheckIfDone
    ]
  ,testGroup "Nested iteratees" [
    testProperty "mapStream identity" prop_mapStream
    ,testProperty "mapStream identity 2" prop_mapStream2
    ,testProperty "mapStream identity joinI" prop_mapjoin
    ,testProperty "rigidMapStream" prop_rigidMapStream
    ,testProperty "breakE" prop_breakE
    ,testProperty "breakE remainder" prop_breakE2
    ,testProperty "take" prop_take
    ,testProperty "take (finished iteratee)" prop_take2
    ,testProperty "takeUpTo" prop_takeUpTo
    ,testProperty "takeUpTo (finished iteratee)" prop_takeUpTo2
    ,testProperty "takeUpTo (remaining stream)" prop_takeUpTo3
    ,testProperty "takeWhile" prop_takeWhile
    ,testProperty "filter" prop_filter
    ,testProperty "group" prop_group
    ,testProperty "groupBy" prop_groupBy
    ,testProperty "convStream EOF" prop_convstream2
    ,testProperty "convStream identity" prop_convstream
    ,testProperty "convStream identity 2" prop_convstream3
    ]
  ,testGroup "Enumerator Combinators" [
    testProperty "enumWith" prop_enumWith
    ,testProperty "enumWith remaining" prop_enumWith2
    ,testProperty "enumWith remaining 2" prop_enumWith3
    ,testProperty "countConsumed" prop_countConsumed
    ]
  ,testGroup "Folds" [
    testProperty "foldl" prop_foldl
   ,testProperty "foldl'" prop_foldl'
   ,testProperty "foldl1" prop_foldl1
   ,testProperty "foldl1'" prop_foldl1'
   ,testProperty "sum" prop_sum
   ,testProperty "product" prop_product
   ]
  ,testGroup "Zips" [
    testProperty "zip" prop_zip
   ,testCase     "sequence_" test_sequence_
   ]
  ,testGroup "Data.Iteratee.Char" [
    --testProperty "line" prop_line
    ]
  ,testGroup "PT variants" [
     testProperty "mapChunksPT" prop_mapChunksPT
    ,testProperty "mapChunksMPT" prop_mapChunksMPT
    ,testProperty "convStreamPT" prop_convStreamPT
    ,testProperty "unfoldConvStreamPT" prop_unfoldConvStreamPT
    ,testProperty "breakEPT" prop_breakEPT
    ,testProperty "takePT" prop_takePT
    ,testProperty "takeUpToPT" prop_takeUpToPT
    ,testProperty "takeWhileEPT" prop_takeWhileEPT
    ,testProperty "mapStreamPT" prop_mapStreamPT
    ,testProperty "rigidMapStreamPT" prop_rigidMapStreamPT
    ,testProperty "filterPT" prop_filterPT
    ]
  ,testGroup "Monadic functions" [
    testProperty "mapM_" prop_mapM_
   ,testProperty "foldM" prop_foldM
   ,testProperty "mapChunksM" prop_mapChunksM
   ,testProperty "mapChunksM_" prop_mapChunksM_
   ,testProperty "foldChunksM" prop_foldChunksM
   ]
  ]
tests = [
  testGroup "Elementary" [
    testProperty "list" prop_list
    ,testProperty "chunkList" prop_clist]
  ,testGroup "Stream tests" [
    testProperty "mempty" prop_mempty
    ,testProperty "mappend" prop_mappend
    ,testProperty "mappend associates" prop_mappend2
    ,testProperty "eq" prop_eq
  ]
  ,testGroup "Simple Iteratees" [
    testProperty "break" prop_break
    ,testProperty "break remainder" prop_break2
    ,testProperty "head" prop_head
    ,testProperty "head remainder" prop_head2
    ,testProperty "tryhead" prop_tryhead
    ,testProperty "heads" prop_heads
    ,testProperty "null heads" prop_heads2
    ,testProperty "peek" prop_peek
    ,testProperty "peek2" prop_peek2
    ,testProperty "last" prop_last1
    ,testProperty "last ends properly" prop_last2
    ,testProperty "length" prop_length
    ,testProperty "chunkLength" prop_chunkLength
    ,testProperty "chunkLength of EoF" prop_chunkLength2
    ,testProperty "takeFromChunk" prop_takeFromChunk
    ,testProperty "drop" prop_drop
    ,testProperty "dropWhile" prop_dropWhile
    ,testProperty "skipToEof" prop_skip
    ,testProperty "iteratee Functor 1" prop_iterFmap
    ,testProperty "iteratee Functor 2" prop_iterFmap2
    ,testProperty "iteratee Monad LI" prop_iterMonad1
    ,testProperty "iteratee Monad RI" prop_iterMonad2
    ,testProperty "iteratee Monad Assc" prop_iterMonad3
    ]
  ,testGroup "Simple Enumerators/Combinators" [
    testProperty "enumPureNChunk" prop_enumChunks
    ,testProperty "enum append 1" prop_app1
    ,testProperty "enum sequencing" prop_app2
    ,testProperty "enum sequencing 2" prop_app3
    ,testProperty "enumEof" prop_eof
    ,testProperty "isFinished" prop_isFinished
    ,testProperty "isFinished error" prop_isFinished2
    ,testProperty "null data idempotence" prop_null
    ,testProperty "null data head idempotence" prop_nullH
    ,testProperty "enumList" prop_enumList
    ,testProperty "enumCheckIfDone" prop_enumCheckIfDone
    ]
  ,testGroup "Nested iteratees" [
    testProperty "mapStream identity" prop_mapStream
    ,testProperty "mapStream identity 2" prop_mapStream2
    ,testProperty "mapStream identity joinI" prop_mapjoin
    ,testProperty "rigidMapStream" prop_rigidMapStream
    ,testProperty "breakE" prop_breakE
    ,testProperty "breakE remainder" prop_breakE2
    ,testProperty "take" prop_take
    ,testProperty "take (finished iteratee)" prop_take2
    ,testProperty "takeUpTo" prop_takeUpTo
    ,testProperty "takeUpTo (finished iteratee)" prop_takeUpTo2
    ,testProperty "takeUpTo (remaining stream)" prop_takeUpTo3
    ,testProperty "takeWhile" prop_takeWhile
    ,testProperty "filter" prop_filter
    ,testProperty "group" prop_group
    ,testProperty "groupBy" prop_groupBy
    ,testProperty "convStream EOF" prop_convstream2
    ,testProperty "convStream identity" prop_convstream
    ,testProperty "convStream identity 2" prop_convstream3
    ]
  ,testGroup "Enumerator Combinators" [
    testProperty "enumWith" prop_enumWith
    ,testProperty "enumWith remaining" prop_enumWith2
    ,testProperty "enumWith remaining 2" prop_enumWith3
    ,testProperty "countConsumed" prop_countConsumed
    ]
  ,testGroup "Folds" [
    testProperty "foldl" prop_foldl
   ,testProperty "foldl'" prop_foldl'
   ,testProperty "foldl1" prop_foldl1
   ,testProperty "foldl1'" prop_foldl1'
   ,testProperty "sum" prop_sum
   ,testProperty "product" prop_product
   ]
  ,testGroup "Zips" [
    testProperty "zip" prop_zip
   ,testCase     "sequence_" test_sequence_
   ]
  ,testGroup "Data.Iteratee.Char" [
    --testProperty "line" prop_line
    ]
  ,testGroup "PT variants" [
     testProperty "mapChunksPT" prop_mapChunksPT
    ,testProperty "mapChunksMPT" prop_mapChunksMPT
    ,testProperty "convStreamPT" prop_convStreamPT
    ,testProperty "unfoldConvStreamPT" prop_unfoldConvStreamPT
    ,testProperty "breakEPT" prop_breakEPT
    ,testProperty "takePT" prop_takePT
    ,testProperty "takeUpToPT" prop_takeUpToPT
    ,testProperty "takeWhileEPT" prop_takeWhileEPT
    ,testProperty "mapStreamPT" prop_mapStreamPT
    ,testProperty "rigidMapStreamPT" prop_rigidMapStreamPT
    ,testProperty "filterPT" prop_filterPT
    ]
  ,testGroup "Monadic functions" [
    testProperty "mapM_" prop_mapM_
   ,testProperty "foldM" prop_foldM
   ,testProperty "mapChunksM" prop_mapChunksM
   ,testProperty "mapChunksM_" prop_mapChunksM_
   ,testProperty "foldChunksM" prop_foldChunksM
   ]
  ]
tests = [
  testGroup "Elementary" [
    testProperty "list" prop_list
    ,testProperty "chunkList" prop_clist]
  ,testGroup "Stream tests" [
    testProperty "mempty" prop_mempty
    ,testProperty "mappend" prop_mappend
    ,testProperty "mappend associates" prop_mappend2
    ,testProperty "eq" prop_eq
  ]
  ,testGroup "Simple Iteratees" [
    testProperty "break" prop_break
    ,testProperty "break remainder" prop_break2
    ,testProperty "head" prop_head
    ,testProperty "head remainder" prop_head2
    ,testProperty "tryhead" prop_tryhead
    ,testProperty "heads" prop_heads
    ,testProperty "null heads" prop_heads2
    ,testProperty "peek" prop_peek
    ,testProperty "peek2" prop_peek2
    ,testProperty "last" prop_last1
    ,testProperty "last ends properly" prop_last2
    ,testProperty "length" prop_length
    ,testProperty "chunkLength" prop_chunkLength
    ,testProperty "chunkLength of EoF" prop_chunkLength2
    ,testProperty "takeFromChunk" prop_takeFromChunk
    ,testProperty "drop" prop_drop
    ,testProperty "dropWhile" prop_dropWhile
    ,testProperty "skipToEof" prop_skip
    ,testProperty "iteratee Functor 1" prop_iterFmap
    ,testProperty "iteratee Functor 2" prop_iterFmap2
    ,testProperty "iteratee Monad LI" prop_iterMonad1
    ,testProperty "iteratee Monad RI" prop_iterMonad2
    ,testProperty "iteratee Monad Assc" prop_iterMonad3
    ]
  ,testGroup "Simple Enumerators/Combinators" [
    testProperty "enumPureNChunk" prop_enumChunks
    ,testProperty "enum append 1" prop_app1
    ,testProperty "enum sequencing" prop_app2
    ,testProperty "enum sequencing 2" prop_app3
    ,testProperty "enumEof" prop_eof
    ,testProperty "isFinished" prop_isFinished
    ,testProperty "isFinished error" prop_isFinished2
    ,testProperty "null data idempotence" prop_null
    ,testProperty "null data head idempotence" prop_nullH
    ,testProperty "enumList" prop_enumList
    ,testProperty "enumCheckIfDone" prop_enumCheckIfDone
    ]
  ,testGroup "Nested iteratees" [
    testProperty "mapStream identity" prop_mapStream
    ,testProperty "mapStream identity 2" prop_mapStream2
    ,testProperty "mapStream identity joinI" prop_mapjoin
    ,testProperty "rigidMapStream" prop_rigidMapStream
    ,testProperty "breakE" prop_breakE
    ,testProperty "breakE remainder" prop_breakE2
    ,testProperty "take" prop_take
    ,testProperty "take (finished iteratee)" prop_take2
    ,testProperty "takeUpTo" prop_takeUpTo
    ,testProperty "takeUpTo (finished iteratee)" prop_takeUpTo2
    ,testProperty "takeUpTo (remaining stream)" prop_takeUpTo3
    ,testProperty "takeWhile" prop_takeWhile
    ,testProperty "filter" prop_filter
    ,testProperty "group" prop_group
    ,testProperty "groupBy" prop_groupBy
    ,testProperty "convStream EOF" prop_convstream2
    ,testProperty "convStream identity" prop_convstream
    ,testProperty "convStream identity 2" prop_convstream3
    ]
  ,testGroup "Enumerator Combinators" [
    testProperty "enumWith" prop_enumWith
    ,testProperty "enumWith remaining" prop_enumWith2
    ,testProperty "enumWith remaining 2" prop_enumWith3
    ,testProperty "countConsumed" prop_countConsumed
    ]
  ,testGroup "Folds" [
    testProperty "foldl" prop_foldl
   ,testProperty "foldl'" prop_foldl'
   ,testProperty "foldl1" prop_foldl1
   ,testProperty "foldl1'" prop_foldl1'
   ,testProperty "sum" prop_sum
   ,testProperty "product" prop_product
   ]
  ,testGroup "Zips" [
    testProperty "zip" prop_zip
   ,testCase     "sequence_" test_sequence_
   ]
  ,testGroup "Data.Iteratee.Char" [
    --testProperty "line" prop_line
    ]
  ,testGroup "PT variants" [
     testProperty "mapChunksPT" prop_mapChunksPT
    ,testProperty "mapChunksMPT" prop_mapChunksMPT
    ,testProperty "convStreamPT" prop_convStreamPT
    ,testProperty "unfoldConvStreamPT" prop_unfoldConvStreamPT
    ,testProperty "breakEPT" prop_breakEPT
    ,testProperty "takePT" prop_takePT
    ,testProperty "takeUpToPT" prop_takeUpToPT
    ,testProperty "takeWhileEPT" prop_takeWhileEPT
    ,testProperty "mapStreamPT" prop_mapStreamPT
    ,testProperty "rigidMapStreamPT" prop_rigidMapStreamPT
    ,testProperty "filterPT" prop_filterPT
    ]
  ,testGroup "Monadic functions" [
    testProperty "mapM_" prop_mapM_
   ,testProperty "foldM" prop_foldM
   ,testProperty "mapChunksM" prop_mapChunksM
   ,testProperty "mapChunksM_" prop_mapChunksM_
   ,testProperty "foldChunksM" prop_foldChunksM
   ]
  ]