2{-# LANGUAGE FlexibleContexts #-}
4module Main (main) where
6import Test.Hspec.QuickCheck
7import Test.QuickCheck (Property, forAll, Gen, listOf, arbitraryUnicodeChar)
8import Test.QuickCheck.Monadic (run, monadicIO, assert)
12import qualified Streamly.Mem.Array as A
13import qualified Streamly.Prelude as S
14import qualified Streamly.String as SS
16-- Coverage build takes too long with default number of tests
24-- Use quickcheck-unicode instead?
25genUnicode :: Gen String
26genUnicode = listOf arbitraryUnicodeChar
28propDecodeEncodeId :: Property
30 forAll genUnicode $ \list ->
32 let wrds = SS.encodeUtf8 $ S.fromList list
33 chrs <- S.toList $ SS.decodeUtf8 wrds
38 forAll genUnicode $ \list ->
44 assert (xs == lines list)
48 forAll genUnicode $ \list ->
54 assert (xs == words list)
56testUnlines :: Property
58 forAll genUnicode $ \list ->
64 assert (xs == unlines (lines list))
66testUnwords :: Property
68 forAll genUnicode $ \list ->
75 assert (xs == unwords (words list))
80 $ modifyMaxSuccess (const 1000)
82 describe "UTF8 - Encoding / Decoding" $ do
83 prop "decodeUtf8 . encodeUtf8 == id" $ propDecodeEncodeId
84 prop "Streamly.String.lines == Prelude.lines" $ testLines
85 prop "Streamly.String.words == Prelude.words" $ testWords
87 "Streamly.String.unlines . Streamly.String.lines == unlines . lines"
90 "Streamly.String.unwords . Streamly.String.words == unwords . words"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list