]> gitweb.michael.orlitzky.com - spline3.git/blob - test/TestSuite.hs
Begin migration to test-framework.
[spline3.git] / test / TestSuite.hs
1 import Test.Framework (defaultMain, testGroup, Test, TestName)
2 import Test.Framework.Providers.HUnit
3 import Test.Framework.Providers.QuickCheck2 (testProperty)
4 import Test.HUnit
5 import Test.QuickCheck
6
7 import Tests.Cardinal
8 import Tests.Cube as TC
9 import Tests.FunctionValues
10 import Tests.Grid
11 import Tests.Misc
12 import Tests.Tetrahedron as TT
13
14 -- The list of HUnit tests.
15 test_suite = TestList (concat [cardinal_tests,
16 function_values_tests,
17 grid_tests,
18 misc_tests,
19 tetrahedron_tests])
20
21 main :: IO ()
22 main = do
23 putStrLn "HUnit"
24 putStrLn "-----"
25 runTestTT test_suite
26 putStrLn ""
27 putStrLn "QuickCheck"
28 putStrLn "----------"
29 let qc_args = stdArgs { maxSuccess = 100,
30 maxDiscard = 500,
31 maxSize = 100 }
32
33
34 -- putStrLn "\np. 78, (2.5)\n"
35
36 -- putStr "prop_cijk1_identity... "
37 -- quickCheckWith qc_args prop_cijk1_identity
38
39
40 putStr "prop_interior_values_all_identical... "
41 quickCheckWith qc_args prop_interior_values_all_identical
42
43 putStr "prop_c_tilde_2100_rotation_correct... "
44 quickCheckWith qc_args prop_c_tilde_2100_rotation_correct
45
46 putStr "prop_x_rotation_doesnt_affect_front... "
47 quickCheckWith qc_args prop_x_rotation_doesnt_affect_front
48
49 putStr "prop_x_rotation_doesnt_affect_back... "
50 quickCheckWith qc_args prop_x_rotation_doesnt_affect_back
51
52 putStr "prop_y_rotation_doesnt_affect_left... "
53 quickCheckWith qc_args prop_y_rotation_doesnt_affect_left
54
55 putStr "prop_y_rotation_doesnt_affect_right... "
56 quickCheckWith qc_args prop_y_rotation_doesnt_affect_right
57
58 putStr "prop_z_rotation_doesnt_affect_top... "
59 quickCheckWith qc_args prop_z_rotation_doesnt_affect_top
60
61 putStr "prop_z_rotation_doesnt_affect_down... "
62 quickCheckWith qc_args prop_z_rotation_doesnt_affect_down
63
64 putStr "prop_c_tilde_2100_correct... "
65 quickCheckWith qc_args prop_c_tilde_2100_correct
66
67
68 putStrLn "\nTetrahedron Tests\n"
69
70 putStr "prop_b0_v0_always_unity... "
71 quickCheckWith qc_args prop_b0_v0_always_unity
72
73 putStr "prop_b0_v1_always_zero... "
74 quickCheckWith qc_args prop_b0_v1_always_zero
75
76 putStr "prop_b0_v2_always_zero... "
77 quickCheckWith qc_args prop_b0_v2_always_zero
78
79 putStr "prop_b0_v3_always_zero... "
80 quickCheckWith qc_args prop_b0_v3_always_zero
81
82 putStr "prop_b1_v1_always_unity... "
83 quickCheckWith qc_args prop_b1_v1_always_unity
84
85 putStr "prop_b1_v0_always_zero... "
86 quickCheckWith qc_args prop_b1_v0_always_zero
87
88 putStr "prop_b1_v2_always_zero... "
89 quickCheckWith qc_args prop_b1_v2_always_zero
90
91 putStr "prop_b1_v3_always_zero... "
92 quickCheckWith qc_args prop_b1_v3_always_zero
93
94 putStr "prop_b2_v2_always_unity... "
95 quickCheckWith qc_args prop_b2_v2_always_unity
96
97 putStr "prop_b2_v0_always_zero... "
98 quickCheckWith qc_args prop_b2_v0_always_zero
99
100 putStr "prop_b2_v1_always_zero... "
101 quickCheckWith qc_args prop_b2_v1_always_zero
102
103 putStr "prop_b2_v3_always_zero... "
104 quickCheckWith qc_args prop_b2_v3_always_zero
105
106 putStr "prop_b3_v3_always_unity... "
107 quickCheckWith qc_args prop_b3_v3_always_unity
108
109 putStr "prop_b3_v0_always_zero... "
110 quickCheckWith qc_args prop_b3_v0_always_zero
111
112 putStr "prop_b3_v1_always_zero... "
113 quickCheckWith qc_args prop_b3_v1_always_zero
114
115 putStr "prop_b3_v2_always_zero... "
116 quickCheckWith qc_args prop_b3_v2_always_zero
117
118 putStr "prop_swapping_vertices_doesnt_affect_coefficients1... "
119 quickCheckWith qc_args prop_swapping_vertices_doesnt_affect_coefficients1
120
121 putStr "prop_swapping_vertices_doesnt_affect_coefficients2... "
122 quickCheckWith qc_args prop_swapping_vertices_doesnt_affect_coefficients2
123
124 putStr "prop_swapping_vertices_doesnt_affect_coefficients3... "
125 quickCheckWith qc_args prop_swapping_vertices_doesnt_affect_coefficients3
126
127 putStr "prop_swapping_vertices_doesnt_affect_coefficients4... "
128 quickCheckWith qc_args prop_swapping_vertices_doesnt_affect_coefficients4
129
130 defaultMain tests
131
132 return ()
133
134
135 -- | Defined so that my test names fit on one line.
136 tp :: Test.QuickCheck.Testable a => TestName -> a -> Test.Framework.Test
137 tp = testProperty
138
139 misc_properties :: Test.Framework.Test
140 misc_properties =
141 testGroup "Misc Properties" [
142 tp "factorial greater" prop_factorial_greater ]
143
144 cardinal_properties :: Test.Framework.Test
145 cardinal_properties =
146 testGroup "Cardinal Properties" [
147 tp "ccwx rotation changes direction" prop_ccwx_rotation_changes_direction,
148 tp "cwx rotation changes direction" prop_cwx_rotation_changes_direction,
149 tp "ccwy rotation changes direction" prop_ccwy_rotation_changes_direction,
150 tp "cwy rotation changes direction" prop_cwy_rotation_changes_direction,
151 tp "ccwz rotation changes direction" prop_ccwz_rotation_changes_direction,
152 tp "cwz rotation changes direction" prop_cwz_rotation_changes_direction,
153 tp "ccwx rotation result unique" prop_ccwx_rotation_result_unique,
154 tp "cwx rotation result unique" prop_cwx_rotation_result_unique,
155 tp "ccwy rotation result unique" prop_ccwy_rotation_result_unique,
156 tp "cwy rotation result unique" prop_cwy_rotation_result_unique,
157 tp "ccwz rotation result unique" prop_ccwz_rotation_result_unique,
158 tp "cwz rotation result unique" prop_cwz_rotation_result_unique,
159 tp "four cwx is identity" prop_four_cwx_is_identity,
160 tp "four ccwx is identity" prop_four_ccwx_is_identity,
161 tp "four cwy is identity" prop_four_cwy_is_identity,
162 tp "four ccwy is identity" prop_four_ccwy_is_identity,
163 tp "four cwz is identity" prop_four_cwz_is_identity,
164 tp "four ccwz is identity" prop_four_ccwz_is_identity]
165
166
167 p78_24_properties :: Test.Framework.Test
168 p78_24_properties =
169 testGroup "p. 78, Section (2.4) Properties" [
170 tp "c3000 identity" TT.prop_c3000_identity,
171 tp "c2100 identity" TT.prop_c2100_identity,
172 tp "c1110 _identity" TT.prop_c1110_identity]
173
174
175 edge_incidence_tests :: Test.Framework.Test
176 edge_incidence_tests =
177 testGroup "Edge Incidence Tests" [
178 tp "t0 shares edge with t6" prop_t0_shares_edge_with_t6,
179 tp "t0 shares edge with t1" prop_t0_shares_edge_with_t1,
180 tp "t0 shares edge with t3" prop_t0_shares_edge_with_t3,
181 tp "t1 shares edge with t2" prop_t1_shares_edge_with_t2,
182 tp "t1 shares edge with t19" prop_t1_shares_edge_with_t19,
183 tp "t2 shares edge with t3" prop_t2_shares_edge_with_t3,
184 tp "t2 shares edge with t12" prop_t2_shares_edge_with_t12,
185 tp "t3 shares edge with t21" prop_t3_shares_edge_with_t21,
186 tp "t4 shares edge with t5" prop_t4_shares_edge_with_t5,
187 tp "t4 shares edge with t7" prop_t4_shares_edge_with_t7,
188 tp "t4 shares edge with t10" prop_t4_shares_edge_with_t10,
189 tp "t5 shares edge with t6" prop_t5_shares_edge_with_t6,
190 tp "t5 shares edge with t16" prop_t5_shares_edge_with_t16,
191 tp "t6 shares edge with t7" prop_t6_shares_edge_with_t7,
192 tp "t7 shares edge with t20" prop_t7_shares_edge_with_t20 ]
193
194
195 p79_26_properties :: Test.Framework.Test
196 p79_26_properties =
197 testGroup "p. 79, Section (2.6) Properties" [
198 tp "c0120 identity1" TC.prop_c0120_identity1,
199 tp "c0120 identity2" TC.prop_c0120_identity2,
200 tp "c0120 identity3" TC.prop_c0120_identity3,
201 --
202 -- These repeats of the previous test are failing at the moment.
203 --
204 -- tp "c0120 identity4" TC.prop_c0120_identity4,
205 -- tp "c0120 identity5" TC.prop_c0120_identity5,
206 -- tp "c0120 identity6" TC.prop_c0120_identity6,
207 tp "c0210 identity1" TC.prop_c0210_identity1,
208 tp "c0300 identity1" TC.prop_c0300_identity1,
209 tp "c1110 identity" TC.prop_c1110_identity,
210 tp "c1200 identity1" TC.prop_c1200_identity1,
211 tp "c2100 identity1" TC.prop_c2100_identity1]
212
213 p79_27_properties :: Test.Framework.Test
214 p79_27_properties =
215 testGroup "p. 79, Section (2.7) Properties" [
216 tp "c0102 identity1" TC.prop_c0102_identity1,
217 tp "c0201 identity1" TC.prop_c0201_identity1,
218 tp "c0300 identity2" TC.prop_c0300_identity2,
219 tp "c1101 identity" TC.prop_c1101_identity,
220 tp "c1200 identity2" TC.prop_c1200_identity2,
221 tp "c2100 identity2" TC.prop_c2100_identity2 ]
222
223
224 p79_28_properties :: Test.Framework.Test
225 p79_28_properties =
226 testGroup "p. 79, Section (2.8) Properties" [
227 tp "c3000 identity" TC.prop_c3000_identity,
228 tp "c2010 identity" TC.prop_c2010_identity,
229 tp "c2001 identity" TC.prop_c2001_identity,
230 tp "c1020 identity" TC.prop_c1020_identity,
231 tp "c1002 identity" TC.prop_c1002_identity,
232 tp "c1011 identity" TC.prop_c1011_identity ]
233
234
235 cube_properties :: Test.Framework.Test
236 cube_properties =
237 testGroup "Cube Properties" [
238 tp "all volumes positive" prop_all_volumes_positive,
239 tp "tetrahedron0 volumes exact" prop_tetrahedron0_volumes_exact,
240 tp "tetrahedron1 volumes exact" prop_tetrahedron1_volumes_exact,
241 tp "tetrahedron2 volumes exact" prop_tetrahedron2_volumes_exact,
242 tp "tetrahedron3 volumes exact" prop_tetrahedron3_volumes_exact,
243 tp "tetrahedron4 volumes exact" prop_tetrahedron4_volumes_exact,
244 tp "tetrahedron5 volumes exact" prop_tetrahedron5_volumes_exact,
245 tp "tetrahedron6 volumes exact" prop_tetrahedron6_volumes_exact,
246 tp "tetrahedron7 volumes exact" prop_tetrahedron7_volumes_exact,
247 tp "tetrahedron8 volumes exact" prop_tetrahedron8_volumes_exact,
248 tp "tetrahedron9 volumes exact" prop_tetrahedron9_volumes_exact,
249 tp "tetrahedron10 volumes exact" prop_tetrahedron10_volumes_exact,
250 tp "tetrahedron11 volumes exact" prop_tetrahedron11_volumes_exact,
251 tp "tetrahedron12 volumes exact" prop_tetrahedron12_volumes_exact,
252 tp "tetrahedron13 volumes exact" prop_tetrahedron13_volumes_exact,
253 tp "tetrahedron14 volumes exact" prop_tetrahedron14_volumes_exact,
254 tp "tetrahedron15 volumes exact" prop_tetrahedron15_volumes_exact,
255 tp "tetrahedron16 volumes exact" prop_tetrahedron16_volumes_exact,
256 tp "tetrahedron17 volumes exact" prop_tetrahedron17_volumes_exact,
257 tp "tetrahedron18 volumes exact" prop_tetrahedron18_volumes_exact,
258 tp "tetrahedron19 volumes exact" prop_tetrahedron19_volumes_exact,
259 tp "tetrahedron20 volumes exact" prop_tetrahedron20_volumes_exact,
260 tp "tetrahedron21 volumes exact" prop_tetrahedron21_volumes_exact,
261 tp "tetrahedron22 volumes exact" prop_tetrahedron22_volumes_exact,
262 tp "tetrahedron23 volumes exact" prop_tetrahedron23_volumes_exact,
263 tp "tetrahedron0 volumes positive" prop_tetrahedron0_volumes_positive,
264 tp "tetrahedron1 volumes positive" prop_tetrahedron1_volumes_positive,
265 tp "tetrahedron2 volumes positive" prop_tetrahedron2_volumes_positive,
266 tp "tetrahedron3 volumes positive" prop_tetrahedron3_volumes_positive,
267 tp "tetrahedron4 volumes positive" prop_tetrahedron4_volumes_positive,
268 tp "tetrahedron5 volumes positive" prop_tetrahedron5_volumes_positive,
269 tp "tetrahedron6 volumes positive" prop_tetrahedron6_volumes_positive,
270 tp "tetrahedron7 volumes positive" prop_tetrahedron7_volumes_positive,
271 tp "tetrahedron8 volumes positive" prop_tetrahedron8_volumes_positive,
272 tp "tetrahedron9 volumes positive" prop_tetrahedron9_volumes_positive,
273 tp "tetrahedron10 volumes positive" prop_tetrahedron10_volumes_positive,
274 tp "tetrahedron11 volumes positive" prop_tetrahedron11_volumes_positive,
275 tp "tetrahedron12 volumes positive" prop_tetrahedron12_volumes_positive,
276 tp "tetrahedron13 volumes positive" prop_tetrahedron13_volumes_positive,
277 tp "tetrahedron14 volumes positive" prop_tetrahedron14_volumes_positive,
278 tp "tetrahedron15 volumes positive" prop_tetrahedron15_volumes_positive,
279 tp "tetrahedron16 volumes positive" prop_tetrahedron16_volumes_positive,
280 tp "tetrahedron17 volumes positive" prop_tetrahedron17_volumes_positive,
281 tp "tetrahedron18 volumes positive" prop_tetrahedron18_volumes_positive,
282 tp "tetrahedron19 volumes positive" prop_tetrahedron19_volumes_positive,
283 tp "tetrahedron20 volumes positive" prop_tetrahedron20_volumes_positive,
284 tp "tetrahedron21 volumes positive" prop_tetrahedron21_volumes_positive,
285 tp "tetrahedron22 volumes positive" prop_tetrahedron22_volumes_positive,
286 tp "tetrahedron23 volumes positive" prop_tetrahedron23_volumes_positive,
287 tp "v0 all equal" prop_v0_all_equal ]
288
289
290 tests :: [Test.Framework.Test]
291 tests = [ cube_properties,
292 misc_properties,
293 cardinal_properties,
294 edge_incidence_tests,
295 p78_24_properties,
296 p79_26_properties,
297 p79_27_properties,
298 p79_28_properties ]