]> gitweb.michael.orlitzky.com - spline3.git/blob - test/TestSuite.hs
Move the Cardinal tests into the Cardinal module.
[spline3.git] / test / TestSuite.hs
1 module TestSuite
2 where
3
4 import Test.Framework (defaultMain, testGroup, Test, TestName, TestOptions(..))
5 import Test.Framework.Providers.API (TestName)
6 import Test.Framework.Providers.DocTest
7 import Test.Framework.Providers.HUnit (testCase)
8 import Test.Framework.Providers.QuickCheck2 (testProperty)
9 import Test.HUnit
10 import Test.QuickCheck (Testable ())
11
12 import Cardinal (cardinal_tests, cardinal_properties)
13 import FunctionValues (function_values_tests, function_values_properties)
14 import Misc (misc_tests, misc_properties)
15 import Tests.Cube as TC
16 import Tests.Grid
17 import Tests.Tetrahedron as TT
18
19 main :: IO ()
20 main = do
21 dt <- docTest ["src/Everything.hs"] ["-isrc"]
22 defaultMain $ [dt] ++ tests
23
24 -- | Defined so that my test names fit on one line.
25 tc :: Test.Framework.Providers.API.TestName -> Test.HUnit.Assertion -> Test.Framework.Test
26 tc = testCase
27
28
29
30 grid_tests :: Test.Framework.Test
31 grid_tests =
32 testGroup "Grid Tests" [
33 trilinear_c0_t0_tests,
34 tc "tetrahedra collision test isn't too sensitive"
35 test_tetrahedra_collision_sensitivity,
36 tc "trilinear reproduced" test_trilinear_reproduced,
37 tc "zeros reproduced" test_zeros_reproduced ]
38
39
40 tetrahedron_tests :: Test.Framework.Test
41 tetrahedron_tests =
42 testGroup "Tetrahedron Tests" [
43 tetrahedron1_geometry_tests,
44 tetrahedron2_geometry_tests,
45 containment_tests ]
46
47 -- | Defined so that my test names fit on one line.
48 tp :: Test.QuickCheck.Testable a => Test.Framework.TestName -> a -> Test.Framework.Test
49 tp = testProperty
50
51
52 p78_24_properties :: Test.Framework.Test
53 p78_24_properties =
54 testGroup "p. 78, Section (2.4) Properties" [
55 tp "c3000 identity" TT.prop_c3000_identity,
56 tp "c2100 identity" TT.prop_c2100_identity,
57 tp "c1110 identity" TT.prop_c1110_identity]
58
59 p78_25_properties :: Test.Framework.Test
60 p78_25_properties =
61 testGroup "p. 78, Section (2.5) Properties" [
62 tp "c_ijk1 identity" prop_cijk1_identity ]
63
64 edge_incidence_tests :: Test.Framework.Test
65 edge_incidence_tests =
66 testGroup "Edge Incidence Tests" [
67 tp "t0 shares edge with t6" prop_t0_shares_edge_with_t6,
68 tp "t0 shares edge with t1" prop_t0_shares_edge_with_t1,
69 tp "t0 shares edge with t3" prop_t0_shares_edge_with_t3,
70 tp "t1 shares edge with t2" prop_t1_shares_edge_with_t2,
71 tp "t1 shares edge with t19" prop_t1_shares_edge_with_t19,
72 tp "t2 shares edge with t3" prop_t2_shares_edge_with_t3,
73 tp "t2 shares edge with t12" prop_t2_shares_edge_with_t12,
74 tp "t3 shares edge with t21" prop_t3_shares_edge_with_t21,
75 tp "t4 shares edge with t5" prop_t4_shares_edge_with_t5,
76 tp "t4 shares edge with t7" prop_t4_shares_edge_with_t7,
77 tp "t4 shares edge with t10" prop_t4_shares_edge_with_t10,
78 tp "t5 shares edge with t6" prop_t5_shares_edge_with_t6,
79 tp "t5 shares edge with t16" prop_t5_shares_edge_with_t16,
80 tp "t6 shares edge with t7" prop_t6_shares_edge_with_t7,
81 tp "t7 shares edge with t20" prop_t7_shares_edge_with_t20 ]
82
83
84 p79_26_properties :: Test.Framework.Test
85 p79_26_properties =
86 testGroup "p. 79, Section (2.6) Properties" [
87 tp "c0120 identity1" TC.prop_c0120_identity1,
88 tp "c0120 identity2" TC.prop_c0120_identity2,
89 tp "c0120 identity3" TC.prop_c0120_identity3,
90 tp "c0120 identity4" TC.prop_c0120_identity4,
91 tp "c0120 identity5" TC.prop_c0120_identity5,
92 tp "c0120 identity6" TC.prop_c0120_identity6,
93 tp "c0120 identity7" TC.prop_c0120_identity7,
94 tp "c0210 identity1" TC.prop_c0210_identity1,
95 tp "c0300 identity1" TC.prop_c0300_identity1,
96 tp "c1110 identity" TC.prop_c1110_identity,
97 tp "c1200 identity1" TC.prop_c1200_identity1,
98 tp "c2100 identity1" TC.prop_c2100_identity1]
99
100 p79_27_properties :: Test.Framework.Test
101 p79_27_properties =
102 testGroup "p. 79, Section (2.7) Properties" [
103 tp "c0102 identity1" TC.prop_c0102_identity1,
104 tp "c0201 identity1" TC.prop_c0201_identity1,
105 tp "c0300 identity2" TC.prop_c0300_identity2,
106 tp "c1101 identity" TC.prop_c1101_identity,
107 tp "c1200 identity2" TC.prop_c1200_identity2,
108 tp "c2100 identity2" TC.prop_c2100_identity2 ]
109
110
111 p79_28_properties :: Test.Framework.Test
112 p79_28_properties =
113 testGroup "p. 79, Section (2.8) Properties" [
114 tp "c3000 identity" TC.prop_c3000_identity,
115 tp "c2010 identity" TC.prop_c2010_identity,
116 tp "c2001 identity" TC.prop_c2001_identity,
117 tp "c1020 identity" TC.prop_c1020_identity,
118 tp "c1002 identity" TC.prop_c1002_identity,
119 tp "c1011 identity" TC.prop_c1011_identity ]
120
121
122 cube_properties :: Test.Framework.Test
123 cube_properties =
124 testGroup "Cube Properties" [
125 tp "front/back tetrahedra are disjoint" prop_front_back_tetrahedra_disjoint,
126 tp "top/down tetrahedra are disjoint" prop_top_down_tetrahedra_disjoint,
127 tp "left/right tetrahedra are disjoint" prop_left_right_tetrahedra_disjoint,
128 tp "all volumes positive" prop_all_volumes_positive,
129 tp "all volumes exact" prop_all_volumes_exact,
130 tp "v0 all equal" prop_v0_all_equal,
131 tp "interior values all identical" prop_interior_values_all_identical,
132 tp "c-tilde_2100 rotation correct" prop_c_tilde_2100_rotation_correct,
133 tp "c-tilde_2100 correct" prop_c_tilde_2100_correct ]
134
135
136 tetrahedron_properties :: Test.Framework.Test
137 tetrahedron_properties =
138 testGroup "Tetrahedron Properties" [
139 tp "b0_v0_always_unity" prop_b0_v0_always_unity,
140 tp "b0_v1_always_zero" prop_b0_v1_always_zero,
141 tp "b0_v2_always_zero" prop_b0_v2_always_zero,
142 tp "b0_v3_always_zero" prop_b0_v3_always_zero,
143 tp "b1_v1_always_unity" prop_b1_v1_always_unity,
144 tp "b1_v0_always_zero" prop_b1_v0_always_zero,
145 tp "b1_v2_always_zero" prop_b1_v2_always_zero,
146 tp "b1_v3_always_zero" prop_b1_v3_always_zero,
147 tp "b2_v2_always_unity" prop_b2_v2_always_unity,
148 tp "b2_v0_always_zero" prop_b2_v0_always_zero,
149 tp "b2_v1_always_zero" prop_b2_v1_always_zero,
150 tp "b2_v3_always_zero" prop_b2_v3_always_zero,
151 tp "b3_v3_always_unity" prop_b3_v3_always_unity,
152 tp "b3_v0_always_zero" prop_b3_v0_always_zero,
153 tp "b3_v1_always_zero" prop_b3_v1_always_zero,
154 tp "b3_v2_always_zero" prop_b3_v2_always_zero,
155 tp "swapping_vertices_doesnt_affect_coefficients1"
156 $ prop_swapping_vertices_doesnt_affect_coefficients1,
157 tp "swapping_vertices_doesnt_affect_coefficients2"
158 $ prop_swapping_vertices_doesnt_affect_coefficients2,
159 tp "swapping_vertices_doesnt_affect_coefficients3"
160 $ prop_swapping_vertices_doesnt_affect_coefficients3,
161 tp "swapping_vertices_doesnt_affect_coefficients4"
162 $ prop_swapping_vertices_doesnt_affect_coefficients4 ]
163
164
165 -- Do the slow tests last so we can stop paying attention.
166 slow_tests :: Test.Framework.Test
167 slow_tests =
168 testGroup "Slow Tests" [
169 tp "cube indices within bounds" prop_cube_indices_never_go_out_of_bounds,
170 tc "trilinear9x9x9 reproduced" test_trilinear9x9x9_reproduced ]
171
172
173 tests :: [Test.Framework.Test]
174 tests = [ cardinal_tests,
175 function_values_tests,
176 grid_tests,
177 misc_tests,
178 tetrahedron_tests,
179 cube_properties,
180 tetrahedron_properties,
181 misc_properties,
182 cardinal_properties,
183 edge_incidence_tests,
184 p78_24_properties,
185 -- p78_25_properties,
186 p79_26_properties,
187 p79_27_properties,
188 p79_28_properties,
189 slow_tests ]