X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FCube.hs;h=6941425a82be541635168da6d5af85feb1a070b7;hb=ecb77f944fcba8c8cfe60ca782bc5d9c8ab68cf9;hp=2ec9e4848318fb12135309900e5505df20f3614e;hpb=cc10c04deda3bdf54867a9052b638f0bc4b09fbe;p=spline3.git diff --git a/src/Cube.hs b/src/Cube.hs index 2ec9e48..6941425 100644 --- a/src/Cube.hs +++ b/src/Cube.hs @@ -1,6 +1,8 @@ module Cube where +import Test.QuickCheck (Arbitrary(..), Gen, Positive(..), choose) + import Cardinal import qualified Face (Face(Face, v0, v1, v2, v3)) import FunctionValues @@ -16,6 +18,19 @@ data Cube = Cube { h :: Double, deriving (Eq) +instance Arbitrary Cube where + arbitrary = do + (Positive h') <- arbitrary :: Gen (Positive Double) + i' <- choose (coordmin, coordmax) + j' <- choose (coordmin, coordmax) + k' <- choose (coordmin, coordmax) + fv' <- arbitrary :: Gen FunctionValues + return (Cube h' i' j' k' fv') + where + coordmin = -268435456 -- -(2^29 / 2) + coordmax = 268435456 -- +(2^29 / 2) + + instance Show Cube where show c = "Cube_" ++ subscript ++ "\n" ++