2-- Module : Streamly.Test.Data.Array
3-- Copyright : (c) 2019 Composewell Technologies
4-- License : BSD-3-Clause
5-- Maintainer : streamly@composewell.com
6-- Stability : experimental
9module Streamly.Test.Data.Array (main) where
11#include "Streamly/Test/Data/Array/CommonImports.hs"
13import qualified Streamly.Internal.Data.Array as A
18moduleName = "Data.Array"
20#include "Streamly/Test/Data/Array/Common.hs"
22testFromStreamToStream :: Property
23testFromStreamToStream = genericTestFromTo (const A.fromStream) A.toStream (==)
25testFoldUnfold :: Property
26testFoldUnfold = genericTestFromTo (const (S.fold A.write)) (S.unfold A.read) (==)
28testFromList :: Property
30 forAll (choose (0, maxArrLen)) $ \len ->
31 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
33 let arr = A.fromList list
34 xs <- run $ S.fold Fold.toList $ S.unfold A.read arr
37testLengthFromStream :: Property
38testLengthFromStream = genericTestFrom (const A.fromStream)
40testReadShowInstance :: Property
42 forAll (choose (0, maxArrLen)) $ \len ->
43 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
45 let arr = A.fromList list
46 assert (A.toList (read (show arr)) == list)
53 modifyMaxSuccess (const maxTestCount) $ do
54 describe moduleName $ do
56 describe "Construction" $ do
57 prop "length . fromStream === n" testLengthFromStream
58 prop "toStream . fromStream === id" testFromStreamToStream
59 prop "read . write === id" testFoldUnfold
60 prop "fromList" testFromList
61 prop "testReadShowInstance" testReadShowInstance
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