-- function used to build the interpolation.
module Grid (
cube_at,
+ grid_properties,
grid_tests,
slow_tests,
zoom )
computeUnboxedP,
fromListUnboxed )
import Data.Array.Repa.Operators.Traversal ( unsafeTraverse )
-import Test.HUnit ( Assertion, assertEqual )
-import Test.Framework ( Test, testGroup )
-import Test.Framework.Providers.HUnit ( testCase )
-import Test.Framework.Providers.QuickCheck2 ( testProperty )
-import Test.QuickCheck (
- (==>),
+import Test.Tasty ( TestTree, testGroup )
+import Test.Tasty.HUnit ( Assertion, assertEqual, testCase )
+import Test.Tasty.QuickCheck (
Arbitrary(..),
Gen,
Property,
+ (==>),
choose,
- vectorOf )
+ vectorOf,
+ testProperty )
+
import Assertions ( assertAlmostEqual, assertTrue )
import Comparisons ( (~=) )
import Cube (
import Point ( Point(..) )
import ScaleFactor ( ScaleFactor )
import Tetrahedron (
- Tetrahedron(v0,v1,v2,v3),
+ Tetrahedron( v0, v1, v2, v3 ),
c,
polynomial )
import Values ( Values3D, dims, empty3d, zoom_shape )
-- values of the function at the grid points, which are distance h=1
-- from one another in each direction (x,y,z).
--
-data Grid = Grid { function_values :: Values3D }
- deriving (Show)
+newtype Grid = Grid { function_values :: Values3D }
+ deriving (Show)
instance Arbitrary Grid where
-- We also verify that the four vertices on face0 of the cube are
-- in the correct location.
--
-trilinear_c0_t0_tests :: Test.Framework.Test
+trilinear_c0_t0_tests :: TestTree
trilinear_c0_t0_tests =
testGroup "trilinear c0 t0"
[testGroup "coefficients"
-- | All of the properties from Section (2.9), p. 80. These require a
-- grid since they refer to two adjacent cubes.
-p80_29_properties :: Test.Framework.Test
+p80_29_properties :: TestTree
p80_29_properties =
- testGroup "p. 80, Section (2.9) Properties" [
+ testGroup "p. 80, Section (2.9) properties" [
testProperty "c0120 identity" prop_c0120_identity,
testProperty "c0111 identity" prop_c0111_identity,
testProperty "c0201 identity" prop_c0201_identity,
testProperty "c0300 identity" prop_c0300_identity ]
-grid_tests :: Test.Framework.Test
+grid_tests :: TestTree
grid_tests =
- testGroup "Grid Tests" [
- trilinear_c0_t0_tests,
- p80_29_properties,
- testProperty "cube indices within bounds"
- prop_cube_indices_never_go_out_of_bounds ]
+ testGroup "Grid tests" [ trilinear_c0_t0_tests ]
+
+grid_properties :: TestTree
+grid_properties =
+ testGroup "Grid properties"
+ [ p80_29_properties,
+ testProperty "cube indices within bounds"
+ prop_cube_indices_never_go_out_of_bounds ]
-- Do the slow tests last so we can stop paying attention.
-slow_tests :: Test.Framework.Test
+slow_tests :: TestTree
slow_tests =
- testGroup "Slow Tests" [
+ testGroup "Slow tests" [
testCase "trilinear reproduced" test_trilinear_reproduced,
testCase "trilinear9x9x9 reproduced" test_trilinear9x9x9_reproduced,
testCase "zeros reproduced" test_zeros_reproduced ]