massiv-test 1.1.0.0 → 1.1.0.1
raw patch · 6 files changed
+25/−14 lines, 6 filesdep ~base
Dependency ranges changed: base
Files
- massiv-test.cabal +1/−1
- src/Test/Massiv/Core/Index.hs +2/−2
- src/Test/Massiv/Utils.hs +9/−4
- tests/Test/Massiv/Array/Manifest/VectorSpec.hs +1/−0
- tests/Test/Massiv/Array/Ops/ConstructSpec.hs +9/−4
- tests/Test/Massiv/Array/Ops/TransformSpec.hs +3/−3
massiv-test.cabal view
@@ -1,5 +1,5 @@ name: massiv-test-version: 1.1.0.0+version: 1.1.0.1 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
src/Test/Massiv/Core/Index.hs view
@@ -46,7 +46,7 @@ import Data.Massiv.Core.Index import Data.Proxy import Data.Typeable-import GHC.Exception (ErrorCall (ErrorCallWithLocation))+import GHC.Exception (ErrorCall (ErrorCall)) import Test.Massiv.Utils -- | Dimension that is always within bounds of an index@@ -517,7 +517,7 @@ sz /= zeroSz ==> assertDeepException- (\(ErrorCallWithLocation err loc) -> err `deepseq` loc `deepseq` True)+ (\(ErrorCall err) -> err `deepseq` True) (negate sz :: Sz ix) prop "abs" $ prop_UnaryNumSz @ix abs
src/Test/Massiv/Utils.hs view
@@ -38,11 +38,17 @@ import Data.Typeable as X import Test.Hspec as X import Test.Hspec.QuickCheck as X-import Test.QuickCheck as X hiding ((.&.)) import Test.QuickCheck.Classes.Base as X+import Test.QuickCheck as X hiding ((.&.)) import Test.QuickCheck.Function as X+import UnliftIO.Exception (Exception (..), SomeException, catchAny)+#if !MIN_VERSION_QuickCheck(2,15,0) import Test.QuickCheck.Monadic as X-import UnliftIO.Exception (Exception (..), SomeException, catch, catchAny)+import UnliftIO.Exception (catch)+#else+import Test.QuickCheck.Monadic (assertDeepException, assertDeepExceptionIO)+import Test.QuickCheck.Monadic as X hiding (assertDeepException, assertDeepExceptionIO)+#endif #if !MIN_VERSION_base(4,11,0) import Data.Semigroup as X ((<>)) #endif@@ -108,8 +114,7 @@ toStringException = either (Left . displayException) Right selectErrorCall :: ErrorCall -> Bool-selectErrorCall = \case- ErrorCallWithLocation err loc -> err `deepseq` loc `deepseq` True+selectErrorCall (ErrorCall err) = err `deepseq` True data ExpectedException = ExpectedException deriving (Show, Eq)
tests/Test/Massiv/Array/Manifest/VectorSpec.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeOperators #-} module Test.Massiv.Array.Manifest.VectorSpec (spec) where
tests/Test/Massiv/Array/Ops/ConstructSpec.hs view
@@ -48,9 +48,12 @@ prop_excFromToListIx2 :: Comp -> [[Int]] -> Property prop_excFromToListIx2 comp ls2 =- if P.null lsL || P.all (head lsL ==) lsL- then label "Expected Success" $ resultLs === ls2- else label "Expected Failure" $ assertSomeException resultLs+ case lsL of+ [] -> label "Expected Success" $ resultLs === ls2+ (x : xs)+ | P.all (x ==) xs ->+ label "Expected Success" $ resultLs === ls2+ _ -> label "Expected Failure" $ assertSomeException resultLs where lsL = P.map P.length ls2 resultLs = toLists (fromLists' comp ls2 :: Array U Ix2 Int)@@ -59,7 +62,9 @@ prop_excFromToListIx3 comp ls3 | P.null (P.concat (P.concat ls3)) = classify True "Expected Success" $ counterexample (show arr) $ totalElem (size arr) === 0- | P.all (head lsL ==) lsL && P.all (P.all (head (head lsLL) ==)) lsLL =+ | (xL : xsL) <- lsL+ , ((xLL : _) : _) <- lsLL+ , P.all (xL ==) xsL && P.all (P.all (xLL ==)) lsLL = classify True "Expected Success" $ counterexample (show arr) $ resultLs === ls3 | otherwise = classify True "Expected Failure" $ assertSomeException resultLs where
tests/Test/Massiv/Array/Ops/TransformSpec.hs view
@@ -9,7 +9,7 @@ module Test.Massiv.Array.Ops.TransformSpec (spec) where -import Data.Foldable as F (foldl', toList)+import qualified Data.Foldable as F import Data.Massiv.Array as A import Data.Maybe import Data.Sequence as S@@ -289,8 +289,8 @@ prop_ConsSnoc :: Array D Ix1 Int -> [SeqOp Int] -> Property prop_ConsSnoc arr ops =- A.toList (computeAs U (foldl' applyArraySeqOp (toLoadArray arr) ops))- === F.toList (foldl' applySequenceSeqOp (S.fromList (A.toList arr)) ops)+ A.toList (computeAs U (F.foldl' applyArraySeqOp (toLoadArray arr) ops))+ === F.toList (F.foldl' applySequenceSeqOp (S.fromList (A.toList arr)) ops) data SeqOp e = Cons e | Snoc e deriving (Eq, Show)