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 =
24 genericTestFromTo (const A.fromStream) A.read (==)
26testFoldUnfold :: Property
28 genericTestFromTo (const (S.fold A.write)) (S.unfold A.reader) (==)
30testFromList :: Property
32 forAll (choose (0, maxArrLen)) $ \len ->
33 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
35 let arr = A.fromList list
36 xs <- run $ S.fold Fold.toList $ S.unfold A.reader arr
39testLengthFromStream :: Property
40testLengthFromStream = genericTestFrom (const A.fromStream)
42testReadShowInstance :: Property
44 forAll (choose (0, maxArrLen)) $ \len ->
45 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
47 let arr = A.fromList list
48 assert (A.toList (read (show arr)) == list)
55 modifyMaxSuccess (const maxTestCount) $ do
56 describe moduleName $ do
58 describe "Construction" $ do
59 prop "length . fromStream === n" testLengthFromStream
60 prop "toStream . fromStream === id" testFromStreamToStream
61 prop "read . write === id" testFoldUnfold
62 prop "fromList" testFromList
63 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