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 where
11#include "Streamly/Test/Data/Array/CommonImports.hs"
13import qualified Streamly.Internal.Data.Array as A
17moduleName = "Data.Array"
19#include "Streamly/Test/Data/Array/Common.hs"
21testFromStreamToStream :: Property
22testFromStreamToStream = genericTestFromTo (const A.fromStream) A.toStream (==)
24testFoldUnfold :: Property
25testFoldUnfold = genericTestFromTo (const (S.fold A.write)) (S.unfold A.read) (==)
27testFromList :: Property
29 forAll (choose (0, maxArrLen)) $ \len ->
30 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
32 let arr = A.fromList list
33 xs <- run $ S.toList $ (S.unfold A.read) arr
36testLengthFromStream :: Property
37testLengthFromStream = genericTestFrom (const A.fromStream)
43 modifyMaxSuccess (const maxTestCount) $ do
44 describe moduleName $ do
46 describe "Construction" $ do
47 prop "length . fromStream === n" testLengthFromStream
48 prop "toStream . fromStream === id" testFromStreamToStream
49 prop "read . write === id" testFoldUnfold
50 prop "fromList" testFromList
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