]> gitweb.michael.orlitzky.com - spline3.git/blob - test/TestSuite.hs
Add 23 more tests for trilinear reproduction, testing the remaining tetrahedra.
[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 Tests.Cardinal
13 import Tests.Cube as TC
14 import Tests.FunctionValues
15 import Tests.Grid
16 import Tests.Misc
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 cardinal_tests :: Test.Framework.Test
29 cardinal_tests =
30 testGroup "Cardinal Tests" [
31 tc "c-tilde_2100 rotation correct" test_c_tilde_2100_rotation_correct ]
32
33 function_values_tests :: Test.Framework.Test
34 function_values_tests =
35 testGroup "FunctionValues Tests" [ tc "test directions" test_directions ]
36
37 grid_tests :: Test.Framework.Test
38 grid_tests =
39 testGroup "Grid Tests" [
40 tc "trilinear c0030" test_trilinear_c0030,
41 tc "trilinear c0003" test_trilinear_c0003,
42 tc "trilinear c0021" test_trilinear_c0021,
43 tc "trilinear c0012" test_trilinear_c0012,
44 tc "trilinear c0120" test_trilinear_c0120,
45 tc "trilinear c0102" test_trilinear_c0102,
46 tc "trilinear c0111" test_trilinear_c0111,
47 tc "trilinear c0210" test_trilinear_c0210,
48 tc "trilinear c0201" test_trilinear_c0201,
49 tc "trilinear c0300" test_trilinear_c0300,
50 tc "trilinear c1020" test_trilinear_c1020,
51 tc "trilinear c1002" test_trilinear_c1002,
52 tc "trilinear c1011" test_trilinear_c1011,
53 tc "trilinear c1110" test_trilinear_c1110,
54 tc "trilinear c1101" test_trilinear_c1101,
55 tc "trilinear c1200" test_trilinear_c1200,
56 tc "trilinear c2010" test_trilinear_c2010,
57 tc "trilinear c2001" test_trilinear_c2001,
58 tc "trilinear c2100" test_trilinear_c2100,
59 tc "trilinear c3000" test_trilinear_c3000,
60 tc "trilinear f0_t0_v0" test_trilinear_f0_t0_v0,
61 tc "trilinear f0_t0_v1" test_trilinear_f0_t0_v1,
62 tc "trilinear f0_t0_v2" test_trilinear_f0_t0_v2,
63 tc "trilinear f0_t0_v3" test_trilinear_f0_t0_v3,
64 tc "trilinear reproduced (t0)" test_trilinear_reproduced_t0,
65 tc "trilinear reproduced (t1)" test_trilinear_reproduced_t1,
66 tc "trilinear reproduced (t2)" test_trilinear_reproduced_t2,
67 tc "trilinear reproduced (t3)" test_trilinear_reproduced_t3,
68 tc "trilinear reproduced (t4)" test_trilinear_reproduced_t4,
69 tc "trilinear reproduced (t5)" test_trilinear_reproduced_t5,
70 tc "trilinear reproduced (t6)" test_trilinear_reproduced_t6,
71 tc "trilinear reproduced (t7)" test_trilinear_reproduced_t7,
72 tc "trilinear reproduced (t8)" test_trilinear_reproduced_t8,
73 tc "trilinear reproduced (t9)" test_trilinear_reproduced_t9,
74 tc "trilinear reproduced (t10)" test_trilinear_reproduced_t10,
75 tc "trilinear reproduced (t11)" test_trilinear_reproduced_t11,
76 tc "trilinear reproduced (t12)" test_trilinear_reproduced_t12,
77 tc "trilinear reproduced (t13)" test_trilinear_reproduced_t13,
78 tc "trilinear reproduced (t14)" test_trilinear_reproduced_t14,
79 tc "trilinear reproduced (t15)" test_trilinear_reproduced_t15,
80 tc "trilinear reproduced (t16)" test_trilinear_reproduced_t16,
81 tc "trilinear reproduced (t17)" test_trilinear_reproduced_t17,
82 tc "trilinear reproduced (t18)" test_trilinear_reproduced_t18,
83 tc "trilinear reproduced (t19)" test_trilinear_reproduced_t19,
84 tc "trilinear reproduced (t20)" test_trilinear_reproduced_t20,
85 tc "trilinear reproduced (t21)" test_trilinear_reproduced_t21,
86 tc "trilinear reproduced (t22)" test_trilinear_reproduced_t22,
87 tc "trilinear reproduced (t23)" test_trilinear_reproduced_t23,
88 tc "zeros reproduced" test_zeros_reproduced ]
89
90
91 misc_tests :: Test.Framework.Test
92 misc_tests =
93 testGroup "Misc Tests" [
94 tc "flatten (1)" test_flatten1 ]
95
96 tetrahedron_tests :: Test.Framework.Test
97 tetrahedron_tests =
98 testGroup "Tetrahedron Tests" [
99 tc "volume (1)" test_volume1,
100 tc "volume (2)" test_volume2,
101 tc "contains point (1)" test_contains_point1,
102 tc "doesn't contain point (1)" test_doesnt_contain_point1,
103 tc "doesn't contain point (2)" test_doesnt_contain_point2,
104 tc "doesn't contain point (3)" test_doesnt_contain_point3,
105 tc "doesn't contain point (4)" test_doesnt_contain_point4,
106 tc "doesn't contain point (5)" test_doesnt_contain_point5 ]
107
108 -- | Defined so that my test names fit on one line.
109 tp :: Test.QuickCheck.Testable a => Test.Framework.TestName -> a -> Test.Framework.Test
110 tp = testProperty
111
112 misc_properties :: Test.Framework.Test
113 misc_properties =
114 testGroup "Misc Properties" [
115 tp "factorial greater" prop_factorial_greater ]
116
117 cardinal_properties :: Test.Framework.Test
118 cardinal_properties =
119 testGroup "Cardinal Properties" [
120 tp "ccwx rotation changes direction" prop_ccwx_rotation_changes_direction,
121 tp "cwx rotation changes direction" prop_cwx_rotation_changes_direction,
122 tp "ccwy rotation changes direction" prop_ccwy_rotation_changes_direction,
123 tp "cwy rotation changes direction" prop_cwy_rotation_changes_direction,
124 tp "ccwz rotation changes direction" prop_ccwz_rotation_changes_direction,
125 tp "cwz rotation changes direction" prop_cwz_rotation_changes_direction,
126 tp "ccwx rotation result unique" prop_ccwx_rotation_result_unique,
127 tp "cwx rotation result unique" prop_cwx_rotation_result_unique,
128 tp "ccwy rotation result unique" prop_ccwy_rotation_result_unique,
129 tp "cwy rotation result unique" prop_cwy_rotation_result_unique,
130 tp "ccwz rotation result unique" prop_ccwz_rotation_result_unique,
131 tp "cwz rotation result unique" prop_cwz_rotation_result_unique,
132 tp "four cwx is identity" prop_four_cwx_is_identity,
133 tp "four ccwx is identity" prop_four_ccwx_is_identity,
134 tp "four cwy is identity" prop_four_cwy_is_identity,
135 tp "four ccwy is identity" prop_four_ccwy_is_identity,
136 tp "four cwz is identity" prop_four_cwz_is_identity,
137 tp "four ccwz is identity" prop_four_ccwz_is_identity]
138
139
140 p78_24_properties :: Test.Framework.Test
141 p78_24_properties =
142 testGroup "p. 78, Section (2.4) Properties" [
143 tp "c3000 identity" TT.prop_c3000_identity,
144 tp "c2100 identity" TT.prop_c2100_identity,
145 tp "c1110 _identity" TT.prop_c1110_identity]
146
147 p78_25_properties :: Test.Framework.Test
148 p78_25_properties =
149 testGroup "p. 78, Section (2.5) Properties" [
150 tp "c_ijk1 identity" prop_cijk1_identity ]
151
152 edge_incidence_tests :: Test.Framework.Test
153 edge_incidence_tests =
154 testGroup "Edge Incidence Tests" [
155 tp "t0 shares edge with t6" prop_t0_shares_edge_with_t6,
156 tp "t0 shares edge with t1" prop_t0_shares_edge_with_t1,
157 tp "t0 shares edge with t3" prop_t0_shares_edge_with_t3,
158 tp "t1 shares edge with t2" prop_t1_shares_edge_with_t2,
159 tp "t1 shares edge with t19" prop_t1_shares_edge_with_t19,
160 tp "t2 shares edge with t3" prop_t2_shares_edge_with_t3,
161 tp "t2 shares edge with t12" prop_t2_shares_edge_with_t12,
162 tp "t3 shares edge with t21" prop_t3_shares_edge_with_t21,
163 tp "t4 shares edge with t5" prop_t4_shares_edge_with_t5,
164 tp "t4 shares edge with t7" prop_t4_shares_edge_with_t7,
165 tp "t4 shares edge with t10" prop_t4_shares_edge_with_t10,
166 tp "t5 shares edge with t6" prop_t5_shares_edge_with_t6,
167 tp "t5 shares edge with t16" prop_t5_shares_edge_with_t16,
168 tp "t6 shares edge with t7" prop_t6_shares_edge_with_t7,
169 tp "t7 shares edge with t20" prop_t7_shares_edge_with_t20 ]
170
171
172 p79_26_properties :: Test.Framework.Test
173 p79_26_properties =
174 testGroup "p. 79, Section (2.6) Properties" [
175 tp "c0120 identity1" TC.prop_c0120_identity1,
176 tp "c0120 identity2" TC.prop_c0120_identity2,
177 tp "c0120 identity3" TC.prop_c0120_identity3,
178 --
179 -- These repeats of the previous test are failing at the moment.
180 --
181 -- tp "c0120 identity4" TC.prop_c0120_identity4,
182 -- tp "c0120 identity5" TC.prop_c0120_identity5,
183 -- tp "c0120 identity6" TC.prop_c0120_identity6,
184 tp "c0210 identity1" TC.prop_c0210_identity1,
185 tp "c0300 identity1" TC.prop_c0300_identity1,
186 tp "c1110 identity" TC.prop_c1110_identity,
187 tp "c1200 identity1" TC.prop_c1200_identity1,
188 tp "c2100 identity1" TC.prop_c2100_identity1]
189
190 p79_27_properties :: Test.Framework.Test
191 p79_27_properties =
192 testGroup "p. 79, Section (2.7) Properties" [
193 tp "c0102 identity1" TC.prop_c0102_identity1,
194 tp "c0201 identity1" TC.prop_c0201_identity1,
195 tp "c0300 identity2" TC.prop_c0300_identity2,
196 tp "c1101 identity" TC.prop_c1101_identity,
197 tp "c1200 identity2" TC.prop_c1200_identity2,
198 tp "c2100 identity2" TC.prop_c2100_identity2 ]
199
200
201 p79_28_properties :: Test.Framework.Test
202 p79_28_properties =
203 testGroup "p. 79, Section (2.8) Properties" [
204 tp "c3000 identity" TC.prop_c3000_identity,
205 tp "c2010 identity" TC.prop_c2010_identity,
206 tp "c2001 identity" TC.prop_c2001_identity,
207 tp "c1020 identity" TC.prop_c1020_identity,
208 tp "c1002 identity" TC.prop_c1002_identity,
209 tp "c1011 identity" TC.prop_c1011_identity ]
210
211
212 cube_properties :: Test.Framework.Test
213 cube_properties =
214 testGroup "Cube Properties" [
215 tp "all volumes positive" prop_all_volumes_positive,
216 tp "tetrahedron0 volumes exact" prop_tetrahedron0_volumes_exact,
217 tp "tetrahedron1 volumes exact" prop_tetrahedron1_volumes_exact,
218 tp "tetrahedron2 volumes exact" prop_tetrahedron2_volumes_exact,
219 tp "tetrahedron3 volumes exact" prop_tetrahedron3_volumes_exact,
220 tp "tetrahedron4 volumes exact" prop_tetrahedron4_volumes_exact,
221 tp "tetrahedron5 volumes exact" prop_tetrahedron5_volumes_exact,
222 tp "tetrahedron6 volumes exact" prop_tetrahedron6_volumes_exact,
223 tp "tetrahedron7 volumes exact" prop_tetrahedron7_volumes_exact,
224 tp "tetrahedron8 volumes exact" prop_tetrahedron8_volumes_exact,
225 tp "tetrahedron9 volumes exact" prop_tetrahedron9_volumes_exact,
226 tp "tetrahedron10 volumes exact" prop_tetrahedron10_volumes_exact,
227 tp "tetrahedron11 volumes exact" prop_tetrahedron11_volumes_exact,
228 tp "tetrahedron12 volumes exact" prop_tetrahedron12_volumes_exact,
229 tp "tetrahedron13 volumes exact" prop_tetrahedron13_volumes_exact,
230 tp "tetrahedron14 volumes exact" prop_tetrahedron14_volumes_exact,
231 tp "tetrahedron15 volumes exact" prop_tetrahedron15_volumes_exact,
232 tp "tetrahedron16 volumes exact" prop_tetrahedron16_volumes_exact,
233 tp "tetrahedron17 volumes exact" prop_tetrahedron17_volumes_exact,
234 tp "tetrahedron18 volumes exact" prop_tetrahedron18_volumes_exact,
235 tp "tetrahedron19 volumes exact" prop_tetrahedron19_volumes_exact,
236 tp "tetrahedron20 volumes exact" prop_tetrahedron20_volumes_exact,
237 tp "tetrahedron21 volumes exact" prop_tetrahedron21_volumes_exact,
238 tp "tetrahedron22 volumes exact" prop_tetrahedron22_volumes_exact,
239 tp "tetrahedron23 volumes exact" prop_tetrahedron23_volumes_exact,
240 tp "tetrahedron0 volumes positive" prop_tetrahedron0_volumes_positive,
241 tp "tetrahedron1 volumes positive" prop_tetrahedron1_volumes_positive,
242 tp "tetrahedron2 volumes positive" prop_tetrahedron2_volumes_positive,
243 tp "tetrahedron3 volumes positive" prop_tetrahedron3_volumes_positive,
244 tp "tetrahedron4 volumes positive" prop_tetrahedron4_volumes_positive,
245 tp "tetrahedron5 volumes positive" prop_tetrahedron5_volumes_positive,
246 tp "tetrahedron6 volumes positive" prop_tetrahedron6_volumes_positive,
247 tp "tetrahedron7 volumes positive" prop_tetrahedron7_volumes_positive,
248 tp "tetrahedron8 volumes positive" prop_tetrahedron8_volumes_positive,
249 tp "tetrahedron9 volumes positive" prop_tetrahedron9_volumes_positive,
250 tp "tetrahedron10 volumes positive" prop_tetrahedron10_volumes_positive,
251 tp "tetrahedron11 volumes positive" prop_tetrahedron11_volumes_positive,
252 tp "tetrahedron12 volumes positive" prop_tetrahedron12_volumes_positive,
253 tp "tetrahedron13 volumes positive" prop_tetrahedron13_volumes_positive,
254 tp "tetrahedron14 volumes positive" prop_tetrahedron14_volumes_positive,
255 tp "tetrahedron15 volumes positive" prop_tetrahedron15_volumes_positive,
256 tp "tetrahedron16 volumes positive" prop_tetrahedron16_volumes_positive,
257 tp "tetrahedron17 volumes positive" prop_tetrahedron17_volumes_positive,
258 tp "tetrahedron18 volumes positive" prop_tetrahedron18_volumes_positive,
259 tp "tetrahedron19 volumes positive" prop_tetrahedron19_volumes_positive,
260 tp "tetrahedron20 volumes positive" prop_tetrahedron20_volumes_positive,
261 tp "tetrahedron21 volumes positive" prop_tetrahedron21_volumes_positive,
262 tp "tetrahedron22 volumes positive" prop_tetrahedron22_volumes_positive,
263 tp "tetrahedron23 volumes positive" prop_tetrahedron23_volumes_positive,
264 tp "v0 all equal" prop_v0_all_equal,
265 tp "interior values all identical" prop_interior_values_all_identical,
266 tp "c-tilde_2100 rotation correct" prop_c_tilde_2100_rotation_correct,
267 tp "c-tilde_2100 correct" prop_c_tilde_2100_correct ]
268
269
270 tetrahedron_properties :: Test.Framework.Test
271 tetrahedron_properties =
272 testGroup "Tetrahedron Properties" [
273 tp "b0_v0_always_unity" prop_b0_v0_always_unity,
274 tp "b0_v1_always_zero" prop_b0_v1_always_zero,
275 tp "b0_v2_always_zero" prop_b0_v2_always_zero,
276 tp "b0_v3_always_zero" prop_b0_v3_always_zero,
277 tp "b1_v1_always_unity" prop_b1_v1_always_unity,
278 tp "b1_v0_always_zero" prop_b1_v0_always_zero,
279 tp "b1_v2_always_zero" prop_b1_v2_always_zero,
280 tp "b1_v3_always_zero" prop_b1_v3_always_zero,
281 tp "b2_v2_always_unity" prop_b2_v2_always_unity,
282 tp "b2_v0_always_zero" prop_b2_v0_always_zero,
283 tp "b2_v1_always_zero" prop_b2_v1_always_zero,
284 tp "b2_v3_always_zero" prop_b2_v3_always_zero,
285 tp "b3_v3_always_unity" prop_b3_v3_always_unity,
286 tp "b3_v0_always_zero" prop_b3_v0_always_zero,
287 tp "b3_v1_always_zero" prop_b3_v1_always_zero,
288 tp "b3_v2_always_zero" prop_b3_v2_always_zero,
289 tp "swapping_vertices_doesnt_affect_coefficients1"
290 $ prop_swapping_vertices_doesnt_affect_coefficients1,
291 tp "swapping_vertices_doesnt_affect_coefficients2"
292 $ prop_swapping_vertices_doesnt_affect_coefficients2,
293 tp "swapping_vertices_doesnt_affect_coefficients3"
294 $ prop_swapping_vertices_doesnt_affect_coefficients3,
295 tp "swapping_vertices_doesnt_affect_coefficients4"
296 $ prop_swapping_vertices_doesnt_affect_coefficients4,
297 tp "x rotation doesn't affect front" prop_x_rotation_doesnt_affect_front,
298 tp "x rotation doesn't affect back" prop_x_rotation_doesnt_affect_back,
299 tp "y rotation doesn't affect left" prop_y_rotation_doesnt_affect_left,
300 tp "y rotation doesn't affect right" prop_y_rotation_doesnt_affect_right,
301 tp "z rotation doesn't affect top" prop_z_rotation_doesnt_affect_top,
302 tp "z rotation doesn't affect down" prop_z_rotation_doesnt_affect_down ]
303
304 tests :: [Test.Framework.Test]
305 tests = [ cardinal_tests,
306 function_values_tests,
307 grid_tests,
308 misc_tests,
309 tetrahedron_tests,
310 cube_properties,
311 tetrahedron_properties,
312 misc_properties,
313 cardinal_properties,
314 edge_incidence_tests,
315 p78_24_properties,
316 -- p78_25_properties,
317 p79_26_properties,
318 p79_27_properties,
319 p79_28_properties ]