From: Michael Orlitzky Date: Wed, 11 May 2011 19:19:36 +0000 (-0400) Subject: Add a test for FunctionValues, test_directions. X-Git-Tag: 0.0.1~294 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=2c2dbf7c58850f3b8294457ca8f4adf9474c7ce7;p=spline3.git Add a test for FunctionValues, test_directions. --- diff --git a/src/Tests/FunctionValues.hs b/src/Tests/FunctionValues.hs index ce9a351..3dc38a4 100644 --- a/src/Tests/FunctionValues.hs +++ b/src/Tests/FunctionValues.hs @@ -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] diff --git a/test/TestSuite.hs b/test/TestSuite.hs index 657994b..baf1ab1 100644 --- a/test/TestSuite.hs +++ b/test/TestSuite.hs @@ -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])