]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - src/Tests/Tetrahedron.hs
Begin fixing some of the tests. Commented out most of them.
[spline3.git] / src / Tests / Tetrahedron.hs
index 98edf63b782af79552d76935552694ec1498590d..d4b7b9bb719a04653ecabb42f04b7a5d2cdf3ed4 100644 (file)
@@ -4,27 +4,21 @@ where
 import Test.HUnit
 import Test.QuickCheck
 
-import Cube
+import Comparisons
 import Point
-import Tests.Cube()
+import FunctionValues
+import Tests.FunctionValues()
 import Tetrahedron
 import ThreeDimensional
 
 instance Arbitrary Tetrahedron where
     arbitrary = do
-      rnd_c0 <- arbitrary :: Gen Cube
       rnd_v0 <- arbitrary :: Gen Point
       rnd_v1 <- arbitrary :: Gen Point
       rnd_v2 <- arbitrary :: Gen Point
       rnd_v3 <- arbitrary :: Gen Point
-      return (Tetrahedron rnd_c0 rnd_v0 rnd_v1 rnd_v2 rnd_v3)
-
-almost_equals :: Double -> Double -> Bool
-almost_equals x y = (abs (x - y)) < 0.0001
-
-(~=) :: Double -> Double -> Bool
-(~=) = almost_equals
-
+      rnd_fv <- arbitrary :: Gen FunctionValues
+      return (Tetrahedron rnd_fv rnd_v0 rnd_v1 rnd_v2 rnd_v3)
 
 -- HUnit Tests
 
@@ -38,11 +32,11 @@ test_volume1 =
       p1 = (0, 0.5, 0)
       p2 = (2, 0, 0)
       p3 = (1, 0, 1)
-      t = Tetrahedron { cube = empty_cube,
-                        v0 = p0,
+      t = Tetrahedron { v0 = p0,
                         v1 = p1,
                         v2 = p2,
-                        v3 = p3 }
+                        v3 = p3,
+                        fv = empty_values }
       vol = volume t
 
 
@@ -56,11 +50,11 @@ test_volume2 =
       p1 = (2, 0, 0)
       p2 = (0, 0.5, 0)
       p3 = (1, 0, 1)
-      t = Tetrahedron { cube = empty_cube,
-                        v0 = p0,
+      t = Tetrahedron { v0 = p0,
                         v1 = p1,
                         v2 = p2,
-                        v3 = p3 }
+                        v3 = p3,
+                        fv = empty_values }
       vol = volume t
 
 test_contains_point1 :: Test
@@ -72,11 +66,11 @@ test_contains_point1 =
       p2 = (2, 0, 0)
       p3 = (1, 0, 1)
       inner_point = (1, 0, 0.5)
-      t = Tetrahedron { cube = empty_cube,
-                        v0 = p0,
+      t = Tetrahedron { v0 = p0,
                         v1 = p1,
                         v2 = p2,
-                        v3 = p3 }
+                        v3 = p3,
+                        fv = empty_values }
 
 
 test_doesnt_contain_point1 :: Test
@@ -88,12 +82,11 @@ test_doesnt_contain_point1 =
       p2 = (2, 0, 0)
       p3 = (1, 0, 1)
       exterior_point = (5, 2, -9.0212)
-      c_empty = empty_cube
-      t = Tetrahedron { cube = c_empty,
-                        v0 = p0,
+      t = Tetrahedron { v0 = p0,
                         v1 = p1,
                         v2 = p2,
-                        v3 = p3 }
+                        v3 = p3,
+                        fv = empty_values }
 
 
 test_doesnt_contain_point2 :: Test
@@ -105,12 +98,11 @@ test_doesnt_contain_point2 =
       p2 = (0.5, 0.5, 1)
       p3 = (0.5, 0.5, 0.5)
       exterior_point = (0, 0, 0)
-      c_empty = empty_cube
-      t = Tetrahedron { cube = c_empty,
-                        v0 = p0,
+      t = Tetrahedron { v0 = p0,
                         v1 = p1,
                         v2 = p2,
-                        v3 = p3 }
+                        v3 = p3,
+                        fv = empty_values }
 
 test_doesnt_contain_point3 :: Test
 test_doesnt_contain_point3 =
@@ -121,12 +113,11 @@ test_doesnt_contain_point3 =
       p2 = (0.5, 0.5, 1)
       p3 = (0.5, 0.5, 0.5)
       exterior_point = (0, 0, 0)
-      c_empty = empty_cube
-      t = Tetrahedron { cube = c_empty,
-                        v0 = p0,
+      t = Tetrahedron { v0 = p0,
                         v1 = p1,
                         v2 = p2,
-                        v3 = p3 }
+                        v3 = p3,
+                        fv = empty_values }
 
 test_doesnt_contain_point4 :: Test
 test_doesnt_contain_point4 =
@@ -137,12 +128,11 @@ test_doesnt_contain_point4 =
       p2 = (0.5, 0.5, 1)
       p3 = (0.5, 0.5, 0.5)
       exterior_point = (0, 0, 0)
-      c_empty = empty_cube
-      t = Tetrahedron { cube = c_empty,
-                        v0 = p0,
+      t = Tetrahedron { v0 = p0,
                         v1 = p1,
                         v2 = p2,
-                        v3 = p3 }
+                        v3 = p3,
+                        fv = empty_values }
 
 test_doesnt_contain_point5 :: Test
 test_doesnt_contain_point5 =
@@ -153,12 +143,11 @@ test_doesnt_contain_point5 =
       p2 = (0.5, 0.5, 1)
       p3 = (0.5, 0.5, 0.5)
       exterior_point = (0, 0, 0)
-      c_empty = empty_cube
-      t = Tetrahedron { cube = c_empty,
-                        v0 = p0,
+      t = Tetrahedron { v0 = p0,
                         v1 = p1,
                         v2 = p2,
-                        v3 = p3 }
+                        v3 = p3,
+                        fv = empty_values }
 
 tetrahedron_tests :: [Test]
 tetrahedron_tests = [test_volume1,