X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FTests%2FCube.hs;h=a832f5a388eec53ca32131575a7f42c9b81c380e;hb=33998c9e4eac925df771d224befc5c0974f877bf;hp=eee54449beaba02a3881f5fe06be2b633abd2cdb;hpb=6fb9ab6b6068870323e996da931fc04c7710e3e4;p=spline3.git diff --git a/src/Tests/Cube.hs b/src/Tests/Cube.hs index eee5444..a832f5a 100644 --- a/src/Tests/Cube.hs +++ b/src/Tests/Cube.hs @@ -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