packages feed

massiv-test 0.1.3.1 → 0.1.4

raw patch · 16 files changed

+353/−224 lines, 16 filesdep ~massiv

Dependency ranges changed: massiv

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.1.4++* Add `ArrDW`+ # 0.1.0  * Initial release.
massiv-test.cabal view
@@ -1,5 +1,5 @@ name:                massiv-test-version:             0.1.3.1+version:             0.1.4 synopsis:            Library that contains generators, properties and tests for Massiv Array Library. description:         This library is designed for users of massiv library that need random generators for writing custom property tests and reusing some of the predefined ones. homepage:            https://github.com/lehins/massiv@@ -32,7 +32,7 @@                      , exceptions                      , QuickCheck                      , hspec-                     , massiv >= 0.5.0+                     , massiv >= 0.5.4                      , scheduler                      , primitive                      , unliftio@@ -54,6 +54,10 @@                     , Test.Massiv.Core.ListSpec                     , Test.Massiv.Core.SchedulerSpec                     , Test.Massiv.Array.Delayed.StreamSpec+                    , Test.Massiv.Array.Delayed.InterleavedSpec+                    , Test.Massiv.Array.Delayed.PushSpec+                    , Test.Massiv.Array.Delayed.WindowedSpec+                    , Test.Massiv.Array.DelayedSpec                     , Test.Massiv.Array.MutableSpec                     , Test.Massiv.Array.Ops.TransformSpec                     , Test.Massiv.Array.Ops.SortSpec@@ -62,10 +66,6 @@                     , Test.Massiv.Array.StencilSpec                     , Test.Massiv.VectorSpec                       -- TODO: Below should be moved to Test.Massiv.Array-                    , Data.Massiv.Array.Delayed.InterleavedSpec-                    , Data.Massiv.Array.Delayed.PushSpec-                    , Data.Massiv.Array.Delayed.WindowedSpec-                    , Data.Massiv.Array.DelayedSpec                     , Data.Massiv.Array.Manifest.VectorSpec                     , Data.Massiv.Array.ManifestSpec                     , Data.Massiv.Array.Ops.ConstructSpec
src/Test/Massiv/Array/Delayed.hs view
@@ -16,6 +16,8 @@   , prop_smapMaybe   , prop_takeDrop   , prop_sunfoldr+  -- * Random reimplementations+  , stackSlices'   ) where  @@ -27,6 +29,17 @@ import Test.Massiv.Utils as T import qualified GHC.Exts as Exts import Data.List as L++-- | Alternative implementation of `stackSlicesM` with `concat'`. Useful for testing and benchmarks+stackSlices' ::+     (Functor f, Foldable f, Resize r (Lower ix), Source r ix e, Load r (Lower ix) e)+  => Dim+  -> f (Array r (Lower ix) e)+  -> Array DL ix e+stackSlices' dim arrsF =+  let fixupSize arr = resize' (Sz (insertDim' (unSz (size arr)) dim 1)) arr+   in concat' dim $ fmap fixupSize arrsF+  compareAsListAndLoaded ::      (Eq e, Show e, Foldable (Array r' Ix1), Load r' Ix1 e) => Array r' Ix1 e -> [e] -> Property
src/Test/Massiv/Array/Mutable.hs view
@@ -69,7 +69,6 @@      forall r ix e.      ( Show (Array r ix e)      , Mutable r ix e-     , Resize r ix      , Source r Ix1 e      , Arbitrary ix      , Arbitrary e@@ -170,7 +169,6 @@      , Mutable r ix e      , Mutable r Ix1 e      , Extract r ix e-     , Resize r ix      , CoArbitrary ix      , Arbitrary e      , CoArbitrary e
src/Test/Massiv/Core/Common.hs view
@@ -1,4 +1,6 @@ {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE UndecidableInstances #-} module Test.Massiv.Core.Common@@ -6,6 +8,7 @@   , ArrTiny(..)   , ArrTinyNE(..)   , ArrIx(..)+  , ArrDW(..)   , module X   ) where @@ -88,3 +91,36 @@     func <- arbitrary     comp <- arbitrary     return $ ArrIx (makeArrayLinear comp sz func) ix+++data ArrDW ix e = ArrDW (Array D ix e) (Array DW ix e)++instance (Show ix, Index ix, Ragged L ix e, Load DW ix e, Show e) =>+         Show (ArrDW ix e) where+  show (ArrDW d dw) =+    "Delayed:\n" +++    show d +++    "\nCorresponding Windowed:\n" +++    --show dw +++    windowInfo+    where+      windowInfo =+        maybe+          "\n No Window"+          (\Window {windowStart, windowSize} ->+             "\n With Window starting index (" +++             show windowStart ++ ") and size (" ++ show windowSize ++ ")") $+        getWindow dw++instance (Arbitrary ix, CoArbitrary ix, Index ix, Arbitrary e, Typeable e) =>+         Arbitrary (ArrDW ix e) where+  arbitrary = do+    ArrTiny (arr :: Array D ix e) <- arbitrary+    let sz = size arr+    ArrDW arr <$>+      if totalElem sz == 0+        then return (makeArray (getComp arr) sz (evaluate' arr))+        else do+          wix <- flip (liftIndex2 mod) (unSz sz) <$> arbitrary+          wsz <- liftIndex (+1) . flip (liftIndex2 mod) (liftIndex2 (-) (unSz sz) wix) <$> arbitrary+          return $ makeWindowedArray arr wix (Sz wsz) (evaluate' arr)
src/Test/Massiv/Core/Mutable.hs view
@@ -106,7 +106,6 @@      , Show (Array r ix e)      , Mutable r ix e      , Mutable r Ix1 e-     , Resize r ix      )   => ArrIx r ix e   -> NonNegative Ix1@@ -147,7 +146,6 @@      , Show (Vector r e)      , Mutable r ix e      , Mutable r Ix1 e-     , Resize r ix      )   => ArrIx r ix e   -> NonNegative Ix1@@ -173,7 +171,6 @@      , Show (Vector r e)      , Mutable r ix e      , Mutable r Ix1 e-     , Resize r ix      )   => Comp   -> SzIx ix@@ -198,7 +195,6 @@      , Show (Vector r e)      , Mutable r ix e      , Source r Ix1 e-     , Resize r ix      )   => ArrIx r ix e   -> Property@@ -222,7 +218,6 @@      , Show (Vector r e)      , Mutable r ix e      , Source r Ix1 e-     , Resize r ix      )   => ArrIx r ix e   -> e@@ -260,7 +255,6 @@      , Arbitrary ix      , Typeable e      , Typeable ix-     , Resize r ix      )   => Spec unsafeMutableSpec =
− tests/Data/Massiv/Array/Delayed/InterleavedSpec.hs
@@ -1,41 +0,0 @@-{-# LANGUAGE MonoLocalBinds #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE TypeApplications #-}-module Data.Massiv.Array.Delayed.InterleavedSpec-  ( spec-  ) where--import Data.Massiv.Array-import Test.Massiv.Core---prop_EqDelayed ::-     (Ragged L ix Int, Load D ix Int, Load DI ix Int)-  => Array D ix Int-  -> Property-prop_EqDelayed arr = computeAs P arr === computeAs P (toInterleaved arr)---prop_Resize ::-     (Ragged L ix Int, Load D ix Int, Load DI ix Int)-  => Array DI ix Int-  -> Property-prop_Resize arr =-  computeAs P (resize' k arr) === computeAs P (resize' k arrD)-  where-    arrD = fromInterleaved arr-    k = Sz (totalElem (size arr))--spec :: Spec-spec =-  describe "Interleaved same as Delayed" $ do-    it "EqDelayed Ix1" $ property $ prop_EqDelayed @Ix1-    it "EqDelayed Ix2" $ property $ prop_EqDelayed @Ix2-    it "EqDelayed Ix3" $ property $ prop_EqDelayed @Ix3-    it "EqDelayed Ix4" $ property $ prop_EqDelayed @Ix4-    it "EqDelayed Ix5" $ property $ prop_EqDelayed @Ix5-    it "Resize Ix1" $ property $ prop_Resize @Ix1-    it "Resize Ix2" $ property $ prop_Resize @Ix2-    it "Resize Ix3" $ property $ prop_Resize @Ix3-    it "Resize Ix4" $ property $ prop_Resize @Ix4-    it "Resize Ix5" $ property $ prop_Resize @Ix5
− tests/Data/Massiv/Array/Delayed/PushSpec.hs
@@ -1,31 +0,0 @@-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE FlexibleInstances #-}-module Data.Massiv.Array.Delayed.PushSpec (spec) where---- import Data.Massiv.Array.Delayed--- import Data.Massiv.Array.Unsafe--- import Data.Massiv.Array as A-import Test.Massiv.Core----- prop_upsampleDifferentDefault ::---      Proxy ix -> Comp -> SzIx ix -> Int -> Maybe Int -> Property--- prop_upsampleDifferentDefault _ comp (SzIx sz ix) v mDef =---   computeAs P (unsafeMakeLoadArray comp sz mDef $ \ put -> put ix v)---spec :: Spec-spec = pure ()-  -- describe "upsampleDifferentDefault" $ do-  --   it "Ix1" $ property $ prop_upsampleDifferentDefault (Proxy :: Proxy Ix1)-  --   it "Ix2" $ property $ prop_upsampleDifferentDefault (Proxy :: Proxy Ix2)-  --   it "Ix3" $ property $ prop_upsampleDifferentDefault (Proxy :: Proxy Ix3)-  --   it "Ix4" $ property $ prop_upsampleDifferentDefault (Proxy :: Proxy Ix4)-  --   it "Ix5" $ property $ prop_upsampleDifferentDefault (Proxy :: Proxy Ix5)----- identityDL :: Int -> Array DL Ix2 Int--- identityDL n = makeLoadArrayS (Sz2 n n) 0 $ \ writeCell -> do---   let f i = writeCell (i :. i) 1---   A.mapM_ f (0 ... n - 1)
− tests/Data/Massiv/Array/Delayed/WindowedSpec.hs
@@ -1,75 +0,0 @@-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE MonoLocalBinds #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE NamedFieldPuns #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE UndecidableInstances #-}-module Data.Massiv.Array.Delayed.WindowedSpec (spec) where--import Data.Massiv.Array.Delayed-import Data.Massiv.Array.Unsafe-import Data.Massiv.Array as A-import Test.Massiv.Core---data ArrDW ix e = ArrDW (Array D ix e) (Array DW ix e)--instance (Show ix, Index ix, Show (Array D ix e), Show (Array DW ix e)) => Show (ArrDW ix e) where-  show (ArrDW d dw) =-    "Delayed:\n" ++-    show d ++-    "\nCorresponding Windowed:\n" ++-    --show dw ++-    windowInfo-    where-      windowInfo =-        maybe-          "\n No Window"-          (\Window {windowStart, windowSize} ->-             "\n With Window starting index (" ++-             show windowStart ++ ") and size (" ++ show windowSize ++ ")") $-        getWindow dw--instance (Arbitrary ix, CoArbitrary ix, Index ix, Arbitrary e, Typeable e) =>-         Arbitrary (ArrDW ix e) where-  arbitrary = do-    ArrTiny (arr :: Array D ix e) <- arbitrary-    let sz = size arr-    ArrDW arr <$>-      if totalElem sz == 0-        then return (makeArray (getComp arr) sz (unsafeIndex arr))-        else do-          wix <- flip (liftIndex2 mod) (unSz sz) <$> arbitrary-          wsz <- liftIndex (+1) . flip (liftIndex2 mod) (liftIndex2 (-) (unSz sz) wix) <$> arbitrary-          return $ makeWindowedArray arr wix (Sz wsz) (unsafeIndex arr)---prop_EqDelayed ::-     (Ragged L ix Int, Load DW ix Int) => Proxy ix -> ArrDW ix Int -> Property-prop_EqDelayed _ (ArrDW arrD arrDW) =-  computeAs P arrD === computeAs P arrDW--prop_EqDelayedStride ::-     (Ragged L ix Int, StrideLoad DW ix Int) => Proxy ix -> Stride ix -> ArrDW ix Int -> Property-prop_EqDelayedStride _ stride (ArrDW arrD arrDW) =-  computeWithStrideAs P stride arrD === computeWithStrideAs P stride arrDW---spec :: Spec-spec = do-  describe "Equivalency with Delayed" $ do-    it "Ix1" $ property $ prop_EqDelayed (Proxy :: Proxy Ix1)-    it "Ix2" $ property $ prop_EqDelayed (Proxy :: Proxy Ix2)-    it "Ix3" $ property $ prop_EqDelayed (Proxy :: Proxy Ix3)-    it "Ix4" $ property $ prop_EqDelayed (Proxy :: Proxy Ix4)-    it "Ix5" $ property $ prop_EqDelayed (Proxy :: Proxy Ix5)-    it "Ix2T" $ property $ prop_EqDelayed (Proxy :: Proxy Ix2T)-  describe "Equivalency with Stride With Delayed" $ do-    it "Ix1" $ property $ prop_EqDelayedStride (Proxy :: Proxy Ix1)-    it "Ix2" $ property $ prop_EqDelayedStride (Proxy :: Proxy Ix2)-    it "Ix3" $ property $ prop_EqDelayedStride (Proxy :: Proxy Ix3)-    it "Ix4" $ property $ prop_EqDelayedStride (Proxy :: Proxy Ix4)-    it "Ix5" $ property $ prop_EqDelayedStride (Proxy :: Proxy Ix5)-    it "Ix2T" $ property $ prop_EqDelayedStride (Proxy :: Proxy Ix2T)
− tests/Data/Massiv/Array/DelayedSpec.hs
@@ -1,63 +0,0 @@-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE MultiParamTypeClasses #-}-module Data.Massiv.Array.DelayedSpec (spec) where--import Data.Massiv.Array.Unsafe-import Data.Massiv.Array as A-import Test.Massiv.Core---downsampleArr :: Source r ix e => Stride ix -> Array r ix e -> Array D ix e-downsampleArr stride arr =-  unsafeBackpermute (strideSize stride (size arr)) (liftIndex2 (*) (unStride stride)) arr--prop_computeWithStrideEqDownsample ::-     Ragged L ix Int-  => proxy ix-  -> Stride ix-  -> Array D ix Int-  -> Property-prop_computeWithStrideEqDownsample _ stride arr =-  computeWithStride stride arr === computeAs U (downsampleArr stride arr)---prop_computeWithStrideInterleavedEqDownsample ::-     Ragged L ix Int-  => proxy ix-  -> Stride ix-  -> Array D ix Int-  -> Property-prop_computeWithStrideInterleavedEqDownsample _ stride arr =-  computeWithStride stride (toInterleaved arr) === computeAs U (downsampleArr stride arr)--prop_computeWithStrideWindowedEqDownsample ::-     (Ragged L ix Int, StrideLoad DW ix Int)-  => proxy ix-  -> Stride ix-  -> ArrIx D ix Int-  -> Property-prop_computeWithStrideWindowedEqDownsample _ stride (ArrIx arr _) =-  computeWithStride stride (makeWindowedArray arr zeroIndex (size arr) (unsafeIndex arr)) ===-  computeAs U (downsampleArr stride arr)---delayedSpec ::-     (Arbitrary ix, StrideLoad DW ix Int, Ragged L ix Int)-  => String-  -> proxy ix-  -> Spec-delayedSpec dimName proxy =-  describe dimName $ do-    it "computeWithStrideEqDownsample" $ property $ prop_computeWithStrideEqDownsample proxy-    it "computeWithStrideInterleavedEqDownsample" $-      property $ prop_computeWithStrideInterleavedEqDownsample proxy-    it "computeWithStrideWindowedEqDownsample" $-      property $ prop_computeWithStrideWindowedEqDownsample proxy--spec :: Spec-spec = do-  delayedSpec "Ix1" (Proxy :: Proxy Ix1)-  delayedSpec "Ix2" (Proxy :: Proxy Ix2)-  delayedSpec "Ix3" (Proxy :: Proxy Ix3)-  delayedSpec "Ix4" (Proxy :: Proxy Ix4)
+ tests/Test/Massiv/Array/Delayed/InterleavedSpec.hs view
@@ -0,0 +1,41 @@+{-# LANGUAGE MonoLocalBinds #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE TypeApplications #-}+module Test.Massiv.Array.Delayed.InterleavedSpec+  ( spec+  ) where++import Data.Massiv.Array+import Test.Massiv.Core+++prop_EqDelayed ::+     (Ragged L ix Int, Load D ix Int, Load DI ix Int)+  => Array D ix Int+  -> Property+prop_EqDelayed arr = computeAs P arr === computeAs P (toInterleaved arr)+++prop_Resize ::+     (Ragged L ix Int, Load D ix Int, Load DI ix Int)+  => Array DI ix Int+  -> Property+prop_Resize arr =+  computeAs P (resize' k arr) === computeAs P (resize' k arrD)+  where+    arrD = fromInterleaved arr+    k = Sz (totalElem (size arr))++spec :: Spec+spec =+  describe "Interleaved same as Delayed" $ do+    it "EqDelayed Ix1" $ property $ prop_EqDelayed @Ix1+    it "EqDelayed Ix2" $ property $ prop_EqDelayed @Ix2+    it "EqDelayed Ix3" $ property $ prop_EqDelayed @Ix3+    it "EqDelayed Ix4" $ property $ prop_EqDelayed @Ix4+    it "EqDelayed Ix5" $ property $ prop_EqDelayed @Ix5+    it "Resize Ix1" $ property $ prop_Resize @Ix1+    it "Resize Ix2" $ property $ prop_Resize @Ix2+    it "Resize Ix3" $ property $ prop_Resize @Ix3+    it "Resize Ix4" $ property $ prop_Resize @Ix4+    it "Resize Ix5" $ property $ prop_Resize @Ix5
+ tests/Test/Massiv/Array/Delayed/PushSpec.hs view
@@ -0,0 +1,31 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+module Test.Massiv.Array.Delayed.PushSpec (spec) where++-- import Data.Massiv.Array.Delayed+-- import Data.Massiv.Array.Unsafe+-- import Data.Massiv.Array as A+import Test.Massiv.Core+++-- prop_upsampleDifferentDefault ::+--      Proxy ix -> Comp -> SzIx ix -> Int -> Maybe Int -> Property+-- prop_upsampleDifferentDefault _ comp (SzIx sz ix) v mDef =+--   computeAs P (unsafeMakeLoadArray comp sz mDef $ \ put -> put ix v)+++spec :: Spec+spec = pure ()+  -- describe "upsampleDifferentDefault" $ do+  --   it "Ix1" $ property $ prop_upsampleDifferentDefault (Proxy :: Proxy Ix1)+  --   it "Ix2" $ property $ prop_upsampleDifferentDefault (Proxy :: Proxy Ix2)+  --   it "Ix3" $ property $ prop_upsampleDifferentDefault (Proxy :: Proxy Ix3)+  --   it "Ix4" $ property $ prop_upsampleDifferentDefault (Proxy :: Proxy Ix4)+  --   it "Ix5" $ property $ prop_upsampleDifferentDefault (Proxy :: Proxy Ix5)+++-- identityDL :: Int -> Array DL Ix2 Int+-- identityDL n = makeLoadArrayS (Sz2 n n) 0 $ \ writeCell -> do+--   let f i = writeCell (i :. i) 1+--   A.mapM_ f (0 ... n - 1)
+ tests/Test/Massiv/Array/Delayed/WindowedSpec.hs view
@@ -0,0 +1,43 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MonoLocalBinds #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE UndecidableInstances #-}+module Test.Massiv.Array.Delayed.WindowedSpec (spec) where++import Data.Massiv.Array.Delayed+import Data.Massiv.Array.Unsafe+import Data.Massiv.Array as A+import Test.Massiv.Core+++prop_EqDelayed ::+     (Ragged L ix Int, Load DW ix Int) => Proxy ix -> ArrDW ix Int -> Property+prop_EqDelayed _ (ArrDW arrD arrDW) =+  computeAs P arrD === computeAs P arrDW++prop_EqDelayedStride ::+     (Ragged L ix Int, StrideLoad DW ix Int) => Proxy ix -> Stride ix -> ArrDW ix Int -> Property+prop_EqDelayedStride _ stride (ArrDW arrD arrDW) =+  computeWithStrideAs P stride arrD === computeWithStrideAs P stride arrDW+++spec :: Spec+spec = do+  describe "Equivalency with Delayed" $ do+    it "Ix1" $ property $ prop_EqDelayed (Proxy :: Proxy Ix1)+    it "Ix2" $ property $ prop_EqDelayed (Proxy :: Proxy Ix2)+    it "Ix3" $ property $ prop_EqDelayed (Proxy :: Proxy Ix3)+    it "Ix4" $ property $ prop_EqDelayed (Proxy :: Proxy Ix4)+    it "Ix5" $ property $ prop_EqDelayed (Proxy :: Proxy Ix5)+    it "Ix2T" $ property $ prop_EqDelayed (Proxy :: Proxy Ix2T)+  describe "Equivalency with Stride With Delayed" $ do+    it "Ix1" $ property $ prop_EqDelayedStride (Proxy :: Proxy Ix1)+    it "Ix2" $ property $ prop_EqDelayedStride (Proxy :: Proxy Ix2)+    it "Ix3" $ property $ prop_EqDelayedStride (Proxy :: Proxy Ix3)+    it "Ix4" $ property $ prop_EqDelayedStride (Proxy :: Proxy Ix4)+    it "Ix5" $ property $ prop_EqDelayedStride (Proxy :: Proxy Ix5)+    it "Ix2T" $ property $ prop_EqDelayedStride (Proxy :: Proxy Ix2T)
+ tests/Test/Massiv/Array/DelayedSpec.hs view
@@ -0,0 +1,63 @@+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+module Test.Massiv.Array.DelayedSpec (spec) where++import Data.Massiv.Array.Unsafe+import Data.Massiv.Array as A+import Test.Massiv.Core+++downsampleArr :: Source r ix e => Stride ix -> Array r ix e -> Array D ix e+downsampleArr stride arr =+  unsafeBackpermute (strideSize stride (size arr)) (liftIndex2 (*) (unStride stride)) arr++prop_computeWithStrideEqDownsample ::+     Ragged L ix Int+  => proxy ix+  -> Stride ix+  -> Array D ix Int+  -> Property+prop_computeWithStrideEqDownsample _ stride arr =+  computeWithStride stride arr === computeAs U (downsampleArr stride arr)+++prop_computeWithStrideInterleavedEqDownsample ::+     Ragged L ix Int+  => proxy ix+  -> Stride ix+  -> Array D ix Int+  -> Property+prop_computeWithStrideInterleavedEqDownsample _ stride arr =+  computeWithStride stride (toInterleaved arr) === computeAs U (downsampleArr stride arr)++prop_computeWithStrideWindowedEqDownsample ::+     (Ragged L ix Int, StrideLoad DW ix Int)+  => proxy ix+  -> Stride ix+  -> ArrIx D ix Int+  -> Property+prop_computeWithStrideWindowedEqDownsample _ stride (ArrIx arr _) =+  computeWithStride stride (makeWindowedArray arr zeroIndex (size arr) (unsafeIndex arr)) ===+  computeAs U (downsampleArr stride arr)+++delayedSpec ::+     (Arbitrary ix, StrideLoad DW ix Int, Ragged L ix Int)+  => String+  -> proxy ix+  -> Spec+delayedSpec dimName proxy =+  describe dimName $ do+    it "computeWithStrideEqDownsample" $ property $ prop_computeWithStrideEqDownsample proxy+    it "computeWithStrideInterleavedEqDownsample" $+      property $ prop_computeWithStrideInterleavedEqDownsample proxy+    it "computeWithStrideWindowedEqDownsample" $+      property $ prop_computeWithStrideWindowedEqDownsample proxy++spec :: Spec+spec = do+  delayedSpec "Ix1" (Proxy :: Proxy Ix1)+  delayedSpec "Ix2" (Proxy :: Proxy Ix2)+  delayedSpec "Ix3" (Proxy :: Proxy Ix3)+  delayedSpec "Ix4" (Proxy :: Proxy Ix4)
tests/Test/Massiv/Array/Ops/MapSpec.hs view
@@ -53,8 +53,48 @@ prop_zipFlip3 arr1 arr2 arr3 =   A.zip3 arr1 arr2 arr3 === A.map (\(e3, e2, e1) -> (e1, e2, e3)) (A.zip3 arr3 arr2 arr1) +prop_zipUnzip4 ::+     (Index ix, Show (Array D ix Int))+  => Array D ix Int+  -> Array D ix Int+  -> Array D ix Int+  -> Array D ix Int+  -> Property+prop_zipUnzip4 arr1 arr2 arr3 arr4 =+  ( extract' zeroIndex sz arr1+  , extract' zeroIndex sz arr2+  , extract' zeroIndex sz arr3+  , extract' zeroIndex sz arr4) ===+  A.unzip4 (A.zip4 arr1 arr2 arr3 arr4)+  where+    sz = sfoldl (liftSz2 min) (size arr1) $ smap size $ sfromList [arr2, arr3, arr4] +prop_zipFlip4 ::+     (Index ix, Show (Array D ix (Int, Int, Int, Int)))+  => Array D ix Int+  -> Array D ix Int+  -> Array D ix Int+  -> Array D ix Int+  -> Property+prop_zipFlip4 arr1 arr2 arr3 arr4 =+  A.zip4 arr1 arr2 arr3 arr4 ===+  A.map (\(e4, e3, e2, e1) -> (e1, e2, e3, e4)) (A.zip4 arr4 arr3 arr2 arr1) ++prop_zip4 ::+     (Index ix, Show (Array D ix (Int, Int, Int, Int)))+  => Array D ix Int+  -> Array D ix Int+  -> Array D ix Int+  -> Array D ix Int+  -> Property+prop_zip4 arr1 arr2 arr3 arr4 =+  let f = (,,,)+   in A.zip4 arr1 arr2 arr3 arr4 ===+      A.zipWith (\(e1, e2) (e3, e4) -> f e1 e2 e3 e4) (A.zip arr1 arr2) (A.zip arr3 arr4)+++ prop_itraverseA ::      (Index ix, Show (Array U ix Int)) => Array D ix Int -> Fun (ix, Int) Int -> Property prop_itraverseA arr fun =@@ -72,6 +112,7 @@      , Show (Array D ix Int)      , Show (Array D ix (Int, Int))      , Show (Array D ix (Int, Int, Int))+     , Show (Array D ix (Int, Int, Int, Int))      )   => Spec mapSpec = do@@ -80,6 +121,9 @@     it "zipFlip" $ property $ prop_zipFlip @ix     it "zipUnzip3" $ property $ prop_zipUnzip3 @ix     it "zipFlip3" $ property $ prop_zipFlip3 @ix+    it "zipUnzip4" $ property $ prop_zipUnzip4 @ix+    it "zipFlip4" $ property $ prop_zipFlip4 @ix+    it "zip" $ property $ prop_zip4 @ix   describe "Traversing" $     it "itraverseA" $ property $ prop_itraverseA @ix   describe "StatefulMapping" $
tests/Test/Massiv/Array/Ops/TransformSpec.hs view
@@ -6,6 +6,7 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeFamilies #-} module Test.Massiv.Array.Ops.TransformSpec (spec) where  import Data.Foldable as F (foldl', toList)@@ -14,6 +15,7 @@ import Data.Sequence as S import Prelude as P import Test.Massiv.Core+import Test.Massiv.Array.Delayed (stackSlices')  prop_TransposeOuterInner :: Array D Ix2 Int -> Property prop_TransposeOuterInner arr = transposeOuter arr === transpose arr@@ -109,6 +111,63 @@     sz = size arr     sz' = Sz (totalElem sz + n) +-- FIXME: deal with overlapping instances for slices, see #106+-- prop_stackInnerSlices ::+--      forall ix.+--      ( Index ix+--      , Index (Lower ix)+--      , Elt M ix Int ~ Array M (Lower ix) Int+--      , Elt P ix Int ~ Array M (Lower ix) Int+--      , Show (Array P ix Int)+--      )+--   => ArrNE P ix Int+--   -> Property+-- prop_stackInnerSlices (ArrNE arr) =+--   arr === either throw compute (stackInnerSlicesM (innerSlices arr)) .&&.+--   arr === compute (stackSlices' 1 (innerSlices arr))+prop_stackInnerSlicesIx2 :: ArrNE P Ix2 Int -> Property+prop_stackInnerSlicesIx2 (ArrNE arr) =+  arr === either throw compute (stackInnerSlicesM (innerSlices arr)) .&&.+  arr === compute (stackSlices' 1 (innerSlices arr))+prop_stackInnerSlicesIx3 :: ArrNE P Ix3 Int -> Property+prop_stackInnerSlicesIx3 (ArrNE arr) =+  arr === either throw compute (stackInnerSlicesM (innerSlices arr)) .&&.+  arr === compute (stackSlices' 1 (innerSlices arr))+prop_stackInnerSlicesIx4 :: ArrNE P Ix4 Int -> Property+prop_stackInnerSlicesIx4 (ArrNE arr) =+  arr === either throw compute (stackInnerSlicesM (innerSlices arr)) .&&.+  arr === compute (stackSlices' 1 (innerSlices arr))++-- prop_stackOuterSlices ::+--      forall ix.+--      ( Index ix+--      , Index (Lower ix)+--      , Elt M ix Int ~ Array M (Lower ix) Int+--      , Elt P ix Int ~ Array M (Lower ix) Int+--      , Show (Array P ix Int)+--      )+--   => ArrNE P ix Int+--   -> Property+-- prop_stackOuterSlices (ArrNE arr) =+--   arr === either throw compute (stackOuterSlicesM (outerSlices arr)) .&&.+--   arr === compute (stackSlices' (dimensions (Proxy :: Proxy ix)) (outerSlices arr))+prop_stackOuterSlicesIx2 :: ArrNE P Ix2 Int -> Property+prop_stackOuterSlicesIx2 (ArrNE arr) =+  arr === either throw compute (stackOuterSlicesM (outerSlices arr)) .&&.+  arr === compute (stackSlices' (dimensions (Proxy :: Proxy Ix2)) (outerSlices arr))+prop_stackOuterSlicesIx3 :: ArrNE P Ix3 Int -> Property+prop_stackOuterSlicesIx3 (ArrNE arr) =+  arr === either throw compute (stackOuterSlicesM (outerSlices arr)) .&&.+  arr === compute (stackSlices' (dimensions (Proxy :: Proxy Ix3)) (outerSlices arr))+prop_stackOuterSlicesIx4 :: ArrNE P Ix4 Int -> Property+prop_stackOuterSlicesIx4 (ArrNE arr) =+  arr === either throw compute (stackOuterSlicesM (outerSlices arr)) .&&.+  arr === compute (stackSlices' (dimensions (Proxy :: Proxy Ix4)) (outerSlices arr))+++++ prop_ZoomWithGridStrideCompute ::      forall r ix e.      ( Eq (Array r ix e)@@ -195,6 +254,19 @@   describe "Sequence" $ do     it "ConsSnoc" $ property prop_ConsSnoc     it "UnconsUnsnoc" $ property prop_UnconsUnsnoc+  describe "slice+stack" $ do+    -- prop "Ix2 - Inner" (prop_stackInnerSlices @Ix2)+    -- prop "Ix3 - Inner" (prop_stackInnerSlices @Ix3)+    -- prop "Ix4 - Inner" (prop_stackInnerSlices @Ix4)+    -- prop "Ix2 - Outer" (prop_stackOuterSlices @Ix2)+    -- prop "Ix3 - Outer" (prop_stackOuterSlices @Ix3)+    -- prop "Ix4 - Outer" (prop_stackOuterSlices @Ix4)+    prop "Ix2 - Inner" prop_stackInnerSlicesIx2+    prop "Ix3 - Inner" prop_stackInnerSlicesIx3+    prop "Ix4 - Inner" prop_stackInnerSlicesIx4+    prop "Ix2 - Outer" prop_stackOuterSlicesIx2+    prop "Ix3 - Outer" prop_stackOuterSlicesIx3+    prop "Ix4 - Outer" prop_stackOuterSlicesIx4   prop_UnconsUnsnoc :: Array D Ix1 Int -> Bool -> Property