]> gitweb.michael.orlitzky.com - spline3.git/blob - test/TestSuite.hs
Finish migrating the QuickCheck tests to test-framework.
[spline3.git] / test / TestSuite.hs
1 import Test.Framework (defaultMain, testGroup, Test, TestName, TestOptions(..))
2 import Test.Framework.Providers.HUnit
3 import Test.Framework.Providers.QuickCheck2 (testProperty)
4 import Test.HUnit
5 import Test.QuickCheck (Testable ())
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
28 defaultMain tests
29
30 return ()
31
32
33 -- | Defined so that my test names fit on one line.
34 tp :: Test.QuickCheck.Testable a => TestName -> a -> Test.Framework.Test
35 tp = testProperty
36
37 misc_properties :: Test.Framework.Test
38 misc_properties =
39 testGroup "Misc Properties" [
40 tp "factorial greater" prop_factorial_greater ]
41
42 cardinal_properties :: Test.Framework.Test
43 cardinal_properties =
44 testGroup "Cardinal Properties" [
45 tp "ccwx rotation changes direction" prop_ccwx_rotation_changes_direction,
46 tp "cwx rotation changes direction" prop_cwx_rotation_changes_direction,
47 tp "ccwy rotation changes direction" prop_ccwy_rotation_changes_direction,
48 tp "cwy rotation changes direction" prop_cwy_rotation_changes_direction,
49 tp "ccwz rotation changes direction" prop_ccwz_rotation_changes_direction,
50 tp "cwz rotation changes direction" prop_cwz_rotation_changes_direction,
51 tp "ccwx rotation result unique" prop_ccwx_rotation_result_unique,
52 tp "cwx rotation result unique" prop_cwx_rotation_result_unique,
53 tp "ccwy rotation result unique" prop_ccwy_rotation_result_unique,
54 tp "cwy rotation result unique" prop_cwy_rotation_result_unique,
55 tp "ccwz rotation result unique" prop_ccwz_rotation_result_unique,
56 tp "cwz rotation result unique" prop_cwz_rotation_result_unique,
57 tp "four cwx is identity" prop_four_cwx_is_identity,
58 tp "four ccwx is identity" prop_four_ccwx_is_identity,
59 tp "four cwy is identity" prop_four_cwy_is_identity,
60 tp "four ccwy is identity" prop_four_ccwy_is_identity,
61 tp "four cwz is identity" prop_four_cwz_is_identity,
62 tp "four ccwz is identity" prop_four_ccwz_is_identity]
63
64
65 p78_24_properties :: Test.Framework.Test
66 p78_24_properties =
67 testGroup "p. 78, Section (2.4) Properties" [
68 tp "c3000 identity" TT.prop_c3000_identity,
69 tp "c2100 identity" TT.prop_c2100_identity,
70 tp "c1110 _identity" TT.prop_c1110_identity]
71
72 p78_25_properties :: Test.Framework.Test
73 p78_25_properties =
74 testGroup "p. 78, Section (2.5) Properties" [
75 tp "c_ijk1 identity" prop_cijk1_identity ]
76
77 edge_incidence_tests :: Test.Framework.Test
78 edge_incidence_tests =
79 testGroup "Edge Incidence Tests" [
80 tp "t0 shares edge with t6" prop_t0_shares_edge_with_t6,
81 tp "t0 shares edge with t1" prop_t0_shares_edge_with_t1,
82 tp "t0 shares edge with t3" prop_t0_shares_edge_with_t3,
83 tp "t1 shares edge with t2" prop_t1_shares_edge_with_t2,
84 tp "t1 shares edge with t19" prop_t1_shares_edge_with_t19,
85 tp "t2 shares edge with t3" prop_t2_shares_edge_with_t3,
86 tp "t2 shares edge with t12" prop_t2_shares_edge_with_t12,
87 tp "t3 shares edge with t21" prop_t3_shares_edge_with_t21,
88 tp "t4 shares edge with t5" prop_t4_shares_edge_with_t5,
89 tp "t4 shares edge with t7" prop_t4_shares_edge_with_t7,
90 tp "t4 shares edge with t10" prop_t4_shares_edge_with_t10,
91 tp "t5 shares edge with t6" prop_t5_shares_edge_with_t6,
92 tp "t5 shares edge with t16" prop_t5_shares_edge_with_t16,
93 tp "t6 shares edge with t7" prop_t6_shares_edge_with_t7,
94 tp "t7 shares edge with t20" prop_t7_shares_edge_with_t20 ]
95
96
97 p79_26_properties :: Test.Framework.Test
98 p79_26_properties =
99 testGroup "p. 79, Section (2.6) Properties" [
100 tp "c0120 identity1" TC.prop_c0120_identity1,
101 tp "c0120 identity2" TC.prop_c0120_identity2,
102 tp "c0120 identity3" TC.prop_c0120_identity3,
103 --
104 -- These repeats of the previous test are failing at the moment.
105 --
106 -- tp "c0120 identity4" TC.prop_c0120_identity4,
107 -- tp "c0120 identity5" TC.prop_c0120_identity5,
108 -- tp "c0120 identity6" TC.prop_c0120_identity6,
109 tp "c0210 identity1" TC.prop_c0210_identity1,
110 tp "c0300 identity1" TC.prop_c0300_identity1,
111 tp "c1110 identity" TC.prop_c1110_identity,
112 tp "c1200 identity1" TC.prop_c1200_identity1,
113 tp "c2100 identity1" TC.prop_c2100_identity1]
114
115 p79_27_properties :: Test.Framework.Test
116 p79_27_properties =
117 testGroup "p. 79, Section (2.7) Properties" [
118 tp "c0102 identity1" TC.prop_c0102_identity1,
119 tp "c0201 identity1" TC.prop_c0201_identity1,
120 tp "c0300 identity2" TC.prop_c0300_identity2,
121 tp "c1101 identity" TC.prop_c1101_identity,
122 tp "c1200 identity2" TC.prop_c1200_identity2,
123 tp "c2100 identity2" TC.prop_c2100_identity2 ]
124
125
126 p79_28_properties :: Test.Framework.Test
127 p79_28_properties =
128 testGroup "p. 79, Section (2.8) Properties" [
129 tp "c3000 identity" TC.prop_c3000_identity,
130 tp "c2010 identity" TC.prop_c2010_identity,
131 tp "c2001 identity" TC.prop_c2001_identity,
132 tp "c1020 identity" TC.prop_c1020_identity,
133 tp "c1002 identity" TC.prop_c1002_identity,
134 tp "c1011 identity" TC.prop_c1011_identity ]
135
136
137 cube_properties :: Test.Framework.Test
138 cube_properties =
139 testGroup "Cube Properties" [
140 tp "all volumes positive" prop_all_volumes_positive,
141 tp "tetrahedron0 volumes exact" prop_tetrahedron0_volumes_exact,
142 tp "tetrahedron1 volumes exact" prop_tetrahedron1_volumes_exact,
143 tp "tetrahedron2 volumes exact" prop_tetrahedron2_volumes_exact,
144 tp "tetrahedron3 volumes exact" prop_tetrahedron3_volumes_exact,
145 tp "tetrahedron4 volumes exact" prop_tetrahedron4_volumes_exact,
146 tp "tetrahedron5 volumes exact" prop_tetrahedron5_volumes_exact,
147 tp "tetrahedron6 volumes exact" prop_tetrahedron6_volumes_exact,
148 tp "tetrahedron7 volumes exact" prop_tetrahedron7_volumes_exact,
149 tp "tetrahedron8 volumes exact" prop_tetrahedron8_volumes_exact,
150 tp "tetrahedron9 volumes exact" prop_tetrahedron9_volumes_exact,
151 tp "tetrahedron10 volumes exact" prop_tetrahedron10_volumes_exact,
152 tp "tetrahedron11 volumes exact" prop_tetrahedron11_volumes_exact,
153 tp "tetrahedron12 volumes exact" prop_tetrahedron12_volumes_exact,
154 tp "tetrahedron13 volumes exact" prop_tetrahedron13_volumes_exact,
155 tp "tetrahedron14 volumes exact" prop_tetrahedron14_volumes_exact,
156 tp "tetrahedron15 volumes exact" prop_tetrahedron15_volumes_exact,
157 tp "tetrahedron16 volumes exact" prop_tetrahedron16_volumes_exact,
158 tp "tetrahedron17 volumes exact" prop_tetrahedron17_volumes_exact,
159 tp "tetrahedron18 volumes exact" prop_tetrahedron18_volumes_exact,
160 tp "tetrahedron19 volumes exact" prop_tetrahedron19_volumes_exact,
161 tp "tetrahedron20 volumes exact" prop_tetrahedron20_volumes_exact,
162 tp "tetrahedron21 volumes exact" prop_tetrahedron21_volumes_exact,
163 tp "tetrahedron22 volumes exact" prop_tetrahedron22_volumes_exact,
164 tp "tetrahedron23 volumes exact" prop_tetrahedron23_volumes_exact,
165 tp "tetrahedron0 volumes positive" prop_tetrahedron0_volumes_positive,
166 tp "tetrahedron1 volumes positive" prop_tetrahedron1_volumes_positive,
167 tp "tetrahedron2 volumes positive" prop_tetrahedron2_volumes_positive,
168 tp "tetrahedron3 volumes positive" prop_tetrahedron3_volumes_positive,
169 tp "tetrahedron4 volumes positive" prop_tetrahedron4_volumes_positive,
170 tp "tetrahedron5 volumes positive" prop_tetrahedron5_volumes_positive,
171 tp "tetrahedron6 volumes positive" prop_tetrahedron6_volumes_positive,
172 tp "tetrahedron7 volumes positive" prop_tetrahedron7_volumes_positive,
173 tp "tetrahedron8 volumes positive" prop_tetrahedron8_volumes_positive,
174 tp "tetrahedron9 volumes positive" prop_tetrahedron9_volumes_positive,
175 tp "tetrahedron10 volumes positive" prop_tetrahedron10_volumes_positive,
176 tp "tetrahedron11 volumes positive" prop_tetrahedron11_volumes_positive,
177 tp "tetrahedron12 volumes positive" prop_tetrahedron12_volumes_positive,
178 tp "tetrahedron13 volumes positive" prop_tetrahedron13_volumes_positive,
179 tp "tetrahedron14 volumes positive" prop_tetrahedron14_volumes_positive,
180 tp "tetrahedron15 volumes positive" prop_tetrahedron15_volumes_positive,
181 tp "tetrahedron16 volumes positive" prop_tetrahedron16_volumes_positive,
182 tp "tetrahedron17 volumes positive" prop_tetrahedron17_volumes_positive,
183 tp "tetrahedron18 volumes positive" prop_tetrahedron18_volumes_positive,
184 tp "tetrahedron19 volumes positive" prop_tetrahedron19_volumes_positive,
185 tp "tetrahedron20 volumes positive" prop_tetrahedron20_volumes_positive,
186 tp "tetrahedron21 volumes positive" prop_tetrahedron21_volumes_positive,
187 tp "tetrahedron22 volumes positive" prop_tetrahedron22_volumes_positive,
188 tp "tetrahedron23 volumes positive" prop_tetrahedron23_volumes_positive,
189 tp "v0 all equal" prop_v0_all_equal,
190 tp "interior values all identical" prop_interior_values_all_identical,
191 tp "c-tilde_2100 rotation correct" prop_c_tilde_2100_rotation_correct,
192 tp "c-tilde_2100 correct" prop_c_tilde_2100_correct ]
193
194
195 tetrahedron_properties :: Test.Framework.Test
196 tetrahedron_properties =
197 testGroup "Tetrahedron Properties" [
198 tp "b0_v0_always_unity" prop_b0_v0_always_unity,
199 tp "b0_v1_always_zero" prop_b0_v1_always_zero,
200 tp "b0_v2_always_zero" prop_b0_v2_always_zero,
201 tp "b0_v3_always_zero" prop_b0_v3_always_zero,
202 tp "b1_v1_always_unity" prop_b1_v1_always_unity,
203 tp "b1_v0_always_zero" prop_b1_v0_always_zero,
204 tp "b1_v2_always_zero" prop_b1_v2_always_zero,
205 tp "b1_v3_always_zero" prop_b1_v3_always_zero,
206 tp "b2_v2_always_unity" prop_b2_v2_always_unity,
207 tp "b2_v0_always_zero" prop_b2_v0_always_zero,
208 tp "b2_v1_always_zero" prop_b2_v1_always_zero,
209 tp "b2_v3_always_zero" prop_b2_v3_always_zero,
210 tp "b3_v3_always_unity" prop_b3_v3_always_unity,
211 tp "b3_v0_always_zero" prop_b3_v0_always_zero,
212 tp "b3_v1_always_zero" prop_b3_v1_always_zero,
213 tp "b3_v2_always_zero" prop_b3_v2_always_zero,
214 tp "swapping_vertices_doesnt_affect_coefficients1"
215 $ prop_swapping_vertices_doesnt_affect_coefficients1,
216 tp "swapping_vertices_doesnt_affect_coefficients2"
217 $ prop_swapping_vertices_doesnt_affect_coefficients2,
218 tp "swapping_vertices_doesnt_affect_coefficients3"
219 $ prop_swapping_vertices_doesnt_affect_coefficients3,
220 tp "swapping_vertices_doesnt_affect_coefficients4"
221 $ prop_swapping_vertices_doesnt_affect_coefficients4,
222 tp "x rotation doesn't affect front" prop_x_rotation_doesnt_affect_front,
223 tp "x rotation doesn't affect back" prop_x_rotation_doesnt_affect_back,
224 tp "y rotation doesn't affect left" prop_y_rotation_doesnt_affect_left,
225 tp "y rotation doesn't affect right" prop_y_rotation_doesnt_affect_right,
226 tp "z rotation doesn't affect top" prop_z_rotation_doesnt_affect_top,
227 tp "z rotation doesn't affect down" prop_z_rotation_doesnt_affect_down ]
228
229 tests :: [Test.Framework.Test]
230 tests = [ cube_properties,
231 tetrahedron_properties,
232 misc_properties,
233 cardinal_properties,
234 edge_incidence_tests,
235 p78_24_properties,
236 -- p78_25_properties,
237 p79_26_properties,
238 p79_27_properties,
239 p79_28_properties ]