1{-# OPTIONS_GHC -Wno-deprecations #-}
4-- Module : Streamly.Test.Data.Array.Generic
5-- Copyright : (c) 2019 Composewell Technologies
6-- License : BSD-3-Clause
7-- Maintainer : streamly@composewell.com
8-- Stability : experimental
11module Streamly.Test.Data.Array.Generic (main) where
13#include "Streamly/Test/Data/Array/CommonImports.hs"
15import qualified Streamly.Internal.Data.Array.Generic as A
20moduleName = "Data.Array"
22#include "Streamly/Test/Data/Array/Common.hs"
24testFromStreamToStream :: Property
25testFromStreamToStream =
26 genericTestFromTo (const A.fromStream) A.read (==)
28testFoldUnfold :: Property
30 genericTestFromTo (const (S.fold A.write)) (S.unfold A.reader) (==)
32testFromList :: Property
34 forAll (choose (0, maxArrLen)) $ \len ->
35 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
37 let arr = A.fromList list
38 xs <- run $ S.fold Fold.toList $ S.unfold A.reader arr
41testLengthFromStream :: Property
42testLengthFromStream = genericTestFrom (const A.fromStream)
44testReadShowInstance :: Property
46 forAll (choose (0, maxArrLen)) $ \len ->
47 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
49 let arr = A.fromList list
50 assert (A.toList (read (show arr)) == list)
57 modifyMaxSuccess (const maxTestCount) $ do
58 describe moduleName $ do
60 describe "Construction" $ do
61 prop "length . fromStream === n" testLengthFromStream
62 prop "toStream . fromStream === id" testFromStreamToStream
63 prop "read . write === id" testFoldUnfold
64 prop "fromList" testFromList
65 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