1module Streamly.Test.Data.MutArray (main) where
3import Test.QuickCheck (listOf)
5import Control.Monad (void)
6import Data.Complex (Complex)
7import Data.Functor.Const (Const)
8import Data.Functor.Identity (Identity)
9import Foreign.Ptr (IntPtr, WordPtr)
11import GHC.Fingerprint.Type (Fingerprint(..))
12import GHC.Int (Int16(..), Int32(..), Int64(..), Int8(..))
13import GHC.Real (Ratio(..))
14import GHC.Stable (StablePtr(..))
15import GHC.Word (Word16(..), Word32(..), Word64(..), Word8(..))
16import Streamly.Internal.Data.MutByteArray (Unbox)
17import Streamly.Test.Common (chooseInt)
18import Test.Hspec (hspec, describe, it)
19import Test.Hspec.QuickCheck
20import Test.QuickCheck (forAll, Property)
21import Test.QuickCheck.Monadic (monadicIO, assert)
22#if MIN_VERSION_base(4,15,0)
23import GHC.RTS.Flags (IoSubSystem(..))
26import qualified Streamly.Internal.Data.MutArray as MArray
27import qualified Streamly.Internal.Data.Stream as Stream
28import qualified Test.Hspec as Hspec
34moduleName = "Data.MutArray"
38 forAll (listOf (chooseInt (-50, 100))) $ \ls0 ->
39 monadicIO $ action ls0
45 (MArray.writeAppend (MArray.pinnedNew 0))
46 (Stream.fromList (ls::[Int]))
47 lst <- MArray.toList x
50#define TEST_IE(_type) it "_type" $ testIE ([] :: [_type])
52-- XXX This should be in test/Data.Unbox
53-- C-ish foreign types are platfor specific. The platform needs to be taken into
54-- consideration when making instances.
55testUnboxInstanceExistance :: Hspec.SpecWith ()
56testUnboxInstanceExistance = do
57 describe "Unbox instances" $ do
70 -- TEST_IE(CSUSeconds)
72 -- TEST_IE(CSigAtomic)
91#if MIN_VERSION_base(4,15,0)
103 -- TEST_IE(CFsBlkCnt)
104 -- TEST_IE(CFsFilCnt)
130 TEST_IE(Identity Int)
131#if MIN_VERSION_base(4,14,0)
137 TEST_IE(StablePtr Int)
138 TEST_IE(Const Int Int)
141 testIE :: Unbox a => [a] -> IO ()
142 testIE lst = void $ MArray.fromList lst
148 modifyMaxSuccess (const maxTestCount) $ do
149 describe moduleName $ do
150 describe "Stream Append" $ do
151 prop "testAppend" testAppend
152 testUnboxInstanceExistance
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