]> gitweb.michael.orlitzky.com - spline3.git/commitdiff
Bump dependencies, and move some Arbitrary code from Values.hs to Grid.hs to avoid...
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 4 Jun 2013 15:16:19 +0000 (11:16 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 4 Jun 2013 15:16:19 +0000 (11:16 -0400)
spline3.cabal
src/Grid.hs
src/Values.hs
test/TestSuite.hs

index 4646863936e17542cde550badaa5c3d77ec02356..b0dc60271893956c19214020e552196fd15ded6c 100644 (file)
@@ -39,9 +39,9 @@ executable spline3
     -- Additional test dependencies.
     HUnit                       == 1.2.*,
     QuickCheck                  == 2.*,
-    test-framework              == 0.6.*,
-    test-framework-hunit        == 0.2.*,
-    test-framework-quickcheck2  == 0.2.*
+    test-framework              == 0.8.*,
+    test-framework-hunit        == 0.3.*,
+    test-framework-quickcheck2  == 0.3.*
 
   main-is:
     Main.hs
@@ -92,9 +92,9 @@ test-suite doctests
   hs-source-dirs: test
   main-is: Doctests.hs
   build-depends:
-    base                        == 4.5.*,
+    base                        == 4.6.*,
     -- Additional test dependencies.
-    doctest                     == 0.7.*
+    doctest                     == 0.9.*
 
   -- It's not entirely clear to me why I have to reproduce all of this.
   ghc-options:
@@ -121,20 +121,20 @@ test-suite testsuite
   hs-source-dirs: src test
   main-is: TestSuite.hs
   build-depends:
-    base                        == 4.5.*,
+    base                        == 4.6.*,
     cmdargs                     == 0.10.*,
     filepath                    == 1.*,
-    MissingH                    == 1.1.*,
+    MissingH                    == 1.2.*,
     repa                        == 3.2.*,
     repa-algorithms             == 3.2.*,
     repa-io                     == 3.2.*,
-    vector                      == 0.9.*,
+    vector                      == 0.10.*,
     -- Additional test dependencies.
     HUnit                       == 1.2.*,
     QuickCheck                  == 2.*,
-    test-framework              == 0.6.*,
-    test-framework-hunit        == 0.2.*,
-    test-framework-quickcheck2  == 0.2.*
+    test-framework              == 0.8.*,
+    test-framework-hunit        == 0.3.*,
+    test-framework-quickcheck2  == 0.3.*
 
   -- It's not entirely clear to me why I have to reproduce all of this.
   ghc-options:
index 953c6a3d56f35978638f50d730814920c2a256dc..269b37cec68d5c2f6211971dc1af32316b86c7ae 100644 (file)
@@ -19,7 +19,8 @@ import Test.QuickCheck ((==>),
                         Arbitrary(..),
                         Gen,
                         Property,
-                        choose)
+                        choose,
+                        vectorOf)
 import Assertions (assertAlmostEqual, assertTrue)
 import Comparisons ((~=))
 import Cube (Cube(Cube),
@@ -49,7 +50,12 @@ data Grid = Grid { function_values :: Values3D }
 
 instance Arbitrary Grid where
     arbitrary = do
-      fvs <- arbitrary :: Gen Values3D
+      x_dim <- choose (1, 27)
+      y_dim <- choose (1, 27)
+      z_dim <- choose (1, 27)
+      elements <- vectorOf (x_dim * y_dim * z_dim) (arbitrary :: Gen Double)
+      let new_shape = (R.Z R.:. x_dim R.:. y_dim R.:. z_dim)
+      let fvs = R.fromListUnboxed new_shape elements
       return $ Grid fvs
 
 
index b5dc15a9c6299bb0ec74511a8e561d6c0bdcf09a..7fc577529f9ccdd2ce0fe1fc85cf14d8744e1e21 100644 (file)
@@ -23,8 +23,6 @@ import Data.Array.Repa (
   )
 
 import System.FilePath ()
-import Test.QuickCheck (Arbitrary(..), Gen, choose, vectorOf)
-
 
 import ScaleFactor (ScaleFactor)
 
@@ -34,18 +32,6 @@ type Values2D  = Values DIM2
 type Values3D  = Values DIM3
 
 
-instance Arbitrary Values3D where
-    arbitrary = do
-      -- I declare not to care about empty lists.
-      x_dim <- choose (1, 27)
-      y_dim <- choose (1, 27)
-      z_dim <- choose (1, 27)
-      elements <- vectorOf (x_dim * y_dim * z_dim) (arbitrary :: Gen Double)
-      let new_shape = (Z :. x_dim :. y_dim :. z_dim)
-      let three_d = Data.Array.Repa.fromListUnboxed new_shape elements
-      return three_d
-
-
 empty3d :: Values3D
 empty3d = Data.Array.Repa.fromListUnboxed (Z :. 0 :. 0 :. 0) []
 
index 4a0b405695247a6d9d440cd9a87f3e1439d350ba..bac18ec2365b27038a9a55428d0160b5070009d0 100644 (file)
@@ -40,16 +40,6 @@ main = do
   defaultMainWithOpts tests my_runner_opts
 
 
--- | Defined so that my test names fit on one line.
-tc :: Test.Framework.Providers.API.TestName -> Test.HUnit.Assertion -> Test.Framework.Test
-tc = testCase
-
-
--- | Defined so that my test names fit on one line.
-tp :: Test.QuickCheck.Testable a => Test.Framework.TestName -> a -> Test.Framework.Test
-tp = testProperty
-
-
 tests :: [Test.Framework.Test]
 tests = [ cardinal_tests,
           function_values_tests,
@@ -58,6 +48,6 @@ tests = [ cardinal_tests,
           tetrahedron_tests,
           cube_properties,
           tetrahedron_properties,
-          misc_properties,          
+          misc_properties,
           cardinal_properties,
           slow_tests ]