]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - src/Tests/Cube.hs
Begin fixing some of the tests. Commented out most of them.
[spline3.git] / src / Tests / Cube.hs
index eee54449beaba02a3881f5fe06be2b633abd2cdb..a832f5a388eec53ca32131575a7f42c9b81c380e 100644 (file)
@@ -3,18 +3,33 @@ where
 
 import Test.QuickCheck
 
-import Cube
-import Grid (Grid)
-import Tests.Grid ()
+import Cube (Cube(Cube))
+import FunctionValues (FunctionValues(FunctionValues))
+import Tests.FunctionValues
 
 instance Arbitrary Cube where
     arbitrary = do
-      g' <- arbitrary :: Gen Grid
+      (Positive h') <- arbitrary :: Gen (Positive Double)
       i' <- choose (coordmin, coordmax)
       j' <- choose (coordmin, coordmax)
       k' <- choose (coordmin, coordmax)
-      d' <- arbitrary :: Gen Double
-      return (Cube g' i' j' k' d')
+      fv' <- arbitrary :: Gen FunctionValues
+      return (Cube h' i' j' k' fv')
         where
           coordmin = -268435456 -- -(2^29 / 2)
           coordmax = 268435456  -- +(2^29 / 2)
+
+
+-- Quickcheck tests.
+
+-- | Since the grid size is necessarily positive, all tetrahedrons
+--   (which comprise cubes of positive volume) must have positive volume
+--   as well.
+-- prop_all_volumes_positive :: Cube -> Property
+-- prop_all_volumes_positive c =
+--     (delta > 0) ==> (null nonpositive_volumes)
+--     where
+--       delta = h (grid c)
+--       ts = tetrahedrons c
+--       volumes = map volume ts
+--       nonpositive_volumes = filter (<= 0) volumes