]> gitweb.michael.orlitzky.com - spline3.git/commitdiff
Add a test for FunctionValues, test_directions.
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 11 May 2011 19:19:36 +0000 (15:19 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 11 May 2011 19:19:36 +0000 (15:19 -0400)
src/Tests/FunctionValues.hs
test/TestSuite.hs

index ce9a35105a24656e790a40cff1ad0030a1ca0da1..3dc38a49764507d0f66e9b00eebb6c4e0d82d564 100644 (file)
@@ -1,8 +1,11 @@
 module Tests.FunctionValues
 where
 
+import Test.HUnit
 import Test.QuickCheck
 
+import Assertions
+import Examples
 import FunctionValues
 
 instance Arbitrary FunctionValues where
@@ -62,3 +65,42 @@ instance Arbitrary FunctionValues where
                             back_right_top = back_right_top',
                             back_right_down = back_right_down',
                             interior = interior' }
+
+
+
+
+test_directions :: Test
+test_directions =
+    TestCase $ assertTrue "all direction functions work" (and equalities)
+        where
+          fvs = make_values trilinear 1 1 1
+          equalities = [ interior fvs == 4,
+                         front fvs == 1,
+                         back  fvs == 7,
+                         left  fvs == 2,
+                         right fvs == 6,
+                         down  fvs == 3,
+                         top   fvs == 5,
+                         front_left fvs == 1,
+                         front_right fvs == 1,
+                         front_down fvs == 1,
+                         front_top fvs == 1,
+                         back_left fvs == 3,
+                         back_right fvs == 11,
+                         back_down fvs == 5,
+                         back_top fvs == 9,
+                         left_down fvs == 2,
+                         left_top fvs == 2,
+                         right_down fvs == 4,
+                         right_top fvs == 8,
+                         front_left_down fvs == 1,
+                         front_left_top fvs == 1,
+                         front_right_down fvs == 1,
+                         front_right_top fvs == 1,
+                         back_left_down fvs == 3,
+                         back_left_top fvs == 3,
+                         back_right_down fvs == 7,
+                         back_right_top fvs == 15]
+
+function_values_tests :: [Test]
+function_values_tests = [test_directions]
index 657994bee4e14e4f70d5dccd9a5fed5b6aa1fb19..baf1ab11ef3679200cc361c5610890d942325424 100644 (file)
@@ -3,12 +3,14 @@ import Test.QuickCheck
 
 import Tests.Cardinal
 import Tests.Cube as TC
+import Tests.FunctionValues
 import Tests.Grid
 import Tests.Misc
 import Tests.Tetrahedron as TT
 
 -- The list of HUnit tests.
-test_suite = TestList (concat [grid_tests,
+test_suite = TestList (concat [function_values_tests,
+                               grid_tests,
                                misc_tests,
                                tetrahedron_tests])