repa-examples 3.2.2.201204.1 → 3.2.3.1
raw patch · 2 files changed
+107/−44 lines, 2 filesdep +QuickCheckdep ~basedep ~repadep ~repa-algorithmsnew-component:exe:repa-unit-test
Dependencies added: QuickCheck
Dependency ranges changed: base, repa, repa-algorithms, repa-io, template-haskell
Files
- examples/UnitTesting/UnitTesting.hs +48/−0
- repa-examples.cabal +59/−44
+ examples/UnitTesting/UnitTesting.hs view
@@ -0,0 +1,48 @@+{-# LANGUAGE TemplateHaskell, ScopedTypeVariables #-}+module Main where+import Data.Array.Repa+import Data.Array.Repa.Arbitrary(forAll2UShaped, forAll2VShaped)+import Test.QuickCheck+import Test.QuickCheck.All+import Control.Monad (liftM2)++-- | Example of how write unit tests for Repa arrays of a given number of dimensions+arrayAdditionU sh + = forAll2UShaped sh test+ where test (a, b) = a +^ b == fromFunction (extent a) (\i -> ((a!i) + (b!i) :: Double))++arrayAdditionV sh + = forAll2VShaped sh test+ where test (a, b) = a +^ b == fromFunction (extent a) (\i -> ((a!i) + (b!i) :: Double))++prop_addU1D :: DIM1 -> Property+prop_addU1D = arrayAdditionU+ +prop_addU2D :: DIM2 -> Property+prop_addU2D = arrayAdditionU++prop_addU3D :: DIM3 -> Property+prop_addU3D = arrayAdditionU+ +prop_addU4D :: DIM4 -> Property+prop_addU4D = arrayAdditionU+ +prop_addU5D :: DIM5 -> Property+prop_addU5D = arrayAdditionU+ +prop_addV1D :: DIM1 -> Property+prop_addV1D = arrayAdditionV+ +prop_addV2D :: DIM2 -> Property+prop_addV2D = arrayAdditionV++prop_addV3D :: DIM3 -> Property+prop_addV3D = arrayAdditionV+ +prop_addV4D :: DIM4 -> Property+prop_addV4D = arrayAdditionV+ +prop_addV5D :: DIM5 -> Property+prop_addV5D = arrayAdditionV+ +main = $quickCheckAll
repa-examples.cabal view
@@ -1,5 +1,5 @@ Name: repa-examples-Version: 3.2.2.201204.1+Version: 3.2.3.1 License: BSD3 License-file: LICENSE Author: The DPH Team@@ -11,9 +11,6 @@ Homepage: http://repa.ouroborus.net Bug-reports: repa@ouroborus.net Description:- Legacy version for Haskell Platform 2012.04. You will get better- performance if you upgrade to the most recent version of GHC.- Examples using the Repa array library. Synopsis:@@ -22,9 +19,9 @@ Executable repa-canny Build-depends: - base == 4.5.*,- repa == 3.2.2.201204.*,- repa-algorithms == 3.2.2.201204.*+ base == 4.6.*,+ repa == 3.2.*,+ repa-algorithms == 3.2.* Main-is: examples/Canny/src-repa/Main.hs hs-source-dirs: examples/Canny/src-repa .@@ -32,17 +29,17 @@ -rtsopts -threaded -eventlog- -Odph+ -Odph -fllvm -optlo-O3 -fno-liberate-case Executable repa-mmult Build-depends: - base == 4.5.*,+ base == 4.6.*, random == 1.0.*,- repa == 3.2.2.201204.*,- repa-io == 3.2.2.201204.*,- repa-algorithms == 3.2.2.201204.*+ repa == 3.2.*,+ repa-io == 3.2.*,+ repa-algorithms == 3.2.* Main-is: examples/MMult/src-repa/Main.hs other-modules: Solver@@ -51,7 +48,7 @@ -rtsopts -threaded -eventlog- -Odph+ -Odph -fllvm -optlo-O3 -fno-liberate-case -funfolding-use-threshold100 -funfolding-keeness-factor100@@ -59,10 +56,10 @@ Executable repa-laplace Build-depends: - base == 4.5.*,- repa == 3.2.2.201204.*,- repa-io == 3.2.2.201204.*,- template-haskell == 2.7.*+ base == 4.6.*,+ repa == 3.2.*,+ repa-io == 3.2.*,+ template-haskell == 2.8.* Main-is: examples/Laplace/src-repa/Main.hs other-modules: SolverGet SolverStencil@@ -71,16 +68,16 @@ -rtsopts -threaded -eventlog- -Odph+ -Odph -fllvm -optlo-O3 -fno-liberate-case Executable repa-fft2d Build-depends: - base == 4.5.*,- repa == 3.2.2.201204.*,- repa-algorithms == 3.2.2.201204.*,- repa-io == 3.2.2.201204.*+ base == 4.6.*,+ repa == 3.2.*,+ repa-algorithms == 3.2.*,+ repa-io == 3.2.* Main-is: examples/FFT/FFT2d/src-repa/Main.hs hs-source-dirs: examples/FFT/FFT2d/src-repa .@@ -88,7 +85,7 @@ -rtsopts -threaded -eventlog- -Odph+ -Odph -fllvm -optlo-O3 -fno-liberate-case -funfolding-use-threshold100 -funfolding-keeness-factor100@@ -96,10 +93,10 @@ Executable repa-fft2d-highpass Build-depends: - base == 4.5.*,- repa == 3.2.2.201204.*,- repa-algorithms == 3.2.2.201204.*,- repa-io == 3.2.2.201204.*+ base == 4.6.*,+ repa == 3.2.*,+ repa-algorithms == 3.2.*,+ repa-io == 3.2.* Main-is: examples/FFT/HighPass2d/src-repa/Main.hs hs-source-dirs: examples/FFT/HighPass2d/src-repa .@@ -107,7 +104,7 @@ -rtsopts -threaded -eventlog- -Odph+ -Odph -fllvm -optlo-O3 -fno-liberate-case -funfolding-use-threshold100 -funfolding-keeness-factor100@@ -116,9 +113,9 @@ Executable repa-fft3d-highpass Build-depends: - base == 4.5.*,- repa == 3.2.2.201204.*,- repa-algorithms == 3.2.2.201204.*+ base == 4.6.*,+ repa == 3.2.*,+ repa-algorithms == 3.2.* Main-is: examples/FFT/HighPass3d/src-repa/Main.hs hs-source-dirs: examples/FFT/HighPass3d/src-repa .@@ -126,7 +123,7 @@ -rtsopts -threaded -eventlog- -Odph+ -Odph -fllvm -optlo-O3 -fno-liberate-case -funfolding-use-threshold100 -funfolding-keeness-factor100@@ -134,10 +131,10 @@ Executable repa-blur Build-depends: - base == 4.5.*,+ base == 4.6.*, vector == 0.10.*,- repa == 3.2.2.201204.*,- repa-algorithms == 3.2.2.201204.*+ repa == 3.2.*,+ repa-algorithms == 3.2.* Main-is: examples/Blur/src-repa/Main.hs hs-source-dirs: examples/Blur/src-repa .@@ -145,7 +142,7 @@ -rtsopts -threaded -eventlog- -Odph+ -Odph -fllvm -optlo-O3 -fno-liberate-case -funfolding-use-threshold100 -funfolding-keeness-factor100@@ -153,9 +150,9 @@ Executable repa-sobel Build-depends: - base == 4.5.*,- repa == 3.2.2.201204.*,- repa-algorithms == 3.2.2.201204.*+ base == 4.6.*,+ repa == 3.2.*,+ repa-algorithms == 3.2.* Main-is: examples/Sobel/src-repa/Main.hs other-modules: Solver@@ -164,7 +161,7 @@ -rtsopts -threaded -eventlog- -Odph+ -Odph -fllvm -optlo-O3 -fno-liberate-case -funfolding-use-threshold100 -funfolding-keeness-factor100@@ -172,16 +169,34 @@ Executable repa-volume Build-depends: - base == 4.5.*,- repa == 3.2.2.201204.*,- repa-io == 3.2.2.201204.*+ base == 4.6.*,+ repa == 3.2.*,+ repa-io == 3.2.* Main-is: examples/Volume/Main.hs ghc-options: -rtsopts -threaded -eventlog- -Odph+ -Odph -fllvm -optlo-O3 -fno-liberate-case -funfolding-use-threshold100 -funfolding-keeness-factor100++Executable repa-unit-test+ Build-depends: + base == 4.*,+ repa == 3.2.*,+ QuickCheck >= 2.3 && < 2.6++ Main-is: examples/UnitTesting/UnitTesting.hs+ hs-source-dirs: examples/UnitTesting .+ ghc-options: + -rtsopts + -threaded + -eventlog+ -Odph -fllvm -optlo-O3+ -fno-liberate-case+ -funfolding-use-threshold100+ -funfolding-keeness-factor100+