]> gitweb.michael.orlitzky.com - spline3.git/commitdiff
Add tests for some functions used in the new 'find_containing_tetrahedron'.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 1 Sep 2011 17:02:23 +0000 (13:02 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 1 Sep 2011 17:02:23 +0000 (13:02 -0400)
src/Tests/Cube.hs
test/TestSuite.hs

index 15103ce190019f3cee2feb006ded3690131924f3..0a1cc504179e9e0c7a79dae01c8ced961ac8b434 100644 (file)
@@ -7,15 +7,35 @@ import Cardinal
 import Comparisons
 import Cube hiding (i, j, k)
 import FunctionValues
-import Misc (all_equal)
+import Misc (all_equal, disjoint)
 import Tests.FunctionValues ()
 import Tetrahedron (b0, b1, b2, b3, c, fv,
                     v0, v1, v2, v3, volume)
 
 
-
 -- Quickcheck tests.
 
+-- | The 'front_half_tetrahedra' and 'back_half_tetrahedra' should
+--   have no tetrahedra in common.
+prop_front_back_tetrahedra_disjoint :: Cube -> Bool
+prop_front_back_tetrahedra_disjoint c =
+    disjoint (front_half_tetrahedra c) (back_half_tetrahedra c)
+
+
+-- | The 'top_half_tetrahedra' and 'down_half_tetrahedra' should
+--   have no tetrahedra in common.
+prop_top_down_tetrahedra_disjoint :: Cube -> Bool
+prop_top_down_tetrahedra_disjoint c =
+    disjoint (top_half_tetrahedra c) (down_half_tetrahedra c)
+
+
+-- | The 'left_half_tetrahedra' and 'right_half_tetrahedra' should
+--   have no tetrahedra in common.
+prop_left_right_tetrahedra_disjoint :: Cube -> Bool
+prop_left_right_tetrahedra_disjoint c =
+    disjoint (left_half_tetrahedra c) (right_half_tetrahedra c)
+
+
 -- | Since the grid size is necessarily positive, all tetrahedra
 --   (which comprise cubes of positive volume) must have positive volume
 --   as well.
index 541694cd17980c4a062e82c52caad77a2a5bef0d..82e287045749e63a0072c1433a4053d95a5d8000 100644 (file)
@@ -162,6 +162,9 @@ p79_28_properties =
 cube_properties :: Test.Framework.Test
 cube_properties =
     testGroup "Cube Properties" [
+  tp "front/back tetrahedra are disjoint" prop_front_back_tetrahedra_disjoint,
+  tp "top/down tetrahedra are disjoint" prop_top_down_tetrahedra_disjoint,
+  tp "left/right tetrahedra are disjoint" prop_left_right_tetrahedra_disjoint,
   tp "all volumes positive" prop_all_volumes_positive,
   tp "all volumes exact" prop_all_volumes_exact,
   tp "v0 all equal" prop_v0_all_equal,