]> gitweb.michael.orlitzky.com - spline3.git/blob - test/TestSuite.hs
Add a new test group, slow_tests, that is run after all of the others.
[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 trilinear_c0_t0_tests,
41 tc "tetrahedra collision test isn't too sensitive"
42 test_tetrahedra_collision_sensitivity,
43 tc "trilinear reproduced" test_trilinear_reproduced,
44 tc "zeros reproduced" test_zeros_reproduced ]
45
46
47 misc_tests :: Test.Framework.Test
48 misc_tests =
49 testGroup "Misc Tests" [
50 tc "flatten (1)" test_flatten1 ]
51
52 tetrahedron_tests :: Test.Framework.Test
53 tetrahedron_tests =
54 testGroup "Tetrahedron Tests" [
55 tetrahedron1_geometry_tests,
56 tetrahedron2_geometry_tests,
57 containment_tests ]
58
59 -- | Defined so that my test names fit on one line.
60 tp :: Test.QuickCheck.Testable a => Test.Framework.TestName -> a -> Test.Framework.Test
61 tp = testProperty
62
63 misc_properties :: Test.Framework.Test
64 misc_properties =
65 testGroup "Misc Properties" [
66 tp "factorial greater" prop_factorial_greater ]
67
68 cardinal_properties :: Test.Framework.Test
69 cardinal_properties =
70 testGroup "Cardinal Properties" [
71 tp "ccwx rotation changes direction" prop_ccwx_rotation_changes_direction,
72 tp "cwx rotation changes direction" prop_cwx_rotation_changes_direction,
73 tp "ccwy rotation changes direction" prop_ccwy_rotation_changes_direction,
74 tp "cwy rotation changes direction" prop_cwy_rotation_changes_direction,
75 tp "ccwz rotation changes direction" prop_ccwz_rotation_changes_direction,
76 tp "cwz rotation changes direction" prop_cwz_rotation_changes_direction,
77 tp "ccwx rotation result unique" prop_ccwx_rotation_result_unique,
78 tp "cwx rotation result unique" prop_cwx_rotation_result_unique,
79 tp "ccwy rotation result unique" prop_ccwy_rotation_result_unique,
80 tp "cwy rotation result unique" prop_cwy_rotation_result_unique,
81 tp "ccwz rotation result unique" prop_ccwz_rotation_result_unique,
82 tp "cwz rotation result unique" prop_cwz_rotation_result_unique,
83 tp "four cwx is identity" prop_four_cwx_is_identity,
84 tp "four ccwx is identity" prop_four_ccwx_is_identity,
85 tp "four cwy is identity" prop_four_cwy_is_identity,
86 tp "four ccwy is identity" prop_four_ccwy_is_identity,
87 tp "four cwz is identity" prop_four_cwz_is_identity,
88 tp "four ccwz is identity" prop_four_ccwz_is_identity]
89
90
91 p78_24_properties :: Test.Framework.Test
92 p78_24_properties =
93 testGroup "p. 78, Section (2.4) Properties" [
94 tp "c3000 identity" TT.prop_c3000_identity,
95 tp "c2100 identity" TT.prop_c2100_identity,
96 tp "c1110 identity" TT.prop_c1110_identity]
97
98 p78_25_properties :: Test.Framework.Test
99 p78_25_properties =
100 testGroup "p. 78, Section (2.5) Properties" [
101 tp "c_ijk1 identity" prop_cijk1_identity ]
102
103 edge_incidence_tests :: Test.Framework.Test
104 edge_incidence_tests =
105 testGroup "Edge Incidence Tests" [
106 tp "t0 shares edge with t6" prop_t0_shares_edge_with_t6,
107 tp "t0 shares edge with t1" prop_t0_shares_edge_with_t1,
108 tp "t0 shares edge with t3" prop_t0_shares_edge_with_t3,
109 tp "t1 shares edge with t2" prop_t1_shares_edge_with_t2,
110 tp "t1 shares edge with t19" prop_t1_shares_edge_with_t19,
111 tp "t2 shares edge with t3" prop_t2_shares_edge_with_t3,
112 tp "t2 shares edge with t12" prop_t2_shares_edge_with_t12,
113 tp "t3 shares edge with t21" prop_t3_shares_edge_with_t21,
114 tp "t4 shares edge with t5" prop_t4_shares_edge_with_t5,
115 tp "t4 shares edge with t7" prop_t4_shares_edge_with_t7,
116 tp "t4 shares edge with t10" prop_t4_shares_edge_with_t10,
117 tp "t5 shares edge with t6" prop_t5_shares_edge_with_t6,
118 tp "t5 shares edge with t16" prop_t5_shares_edge_with_t16,
119 tp "t6 shares edge with t7" prop_t6_shares_edge_with_t7,
120 tp "t7 shares edge with t20" prop_t7_shares_edge_with_t20 ]
121
122
123 p79_26_properties :: Test.Framework.Test
124 p79_26_properties =
125 testGroup "p. 79, Section (2.6) Properties" [
126 tp "c0120 identity1" TC.prop_c0120_identity1,
127 tp "c0120 identity2" TC.prop_c0120_identity2,
128 tp "c0120 identity3" TC.prop_c0120_identity3,
129 tp "c0120 identity4" TC.prop_c0120_identity4,
130 tp "c0120 identity5" TC.prop_c0120_identity5,
131 tp "c0120 identity6" TC.prop_c0120_identity6,
132 tp "c0120 identity7" TC.prop_c0120_identity7,
133 tp "c0210 identity1" TC.prop_c0210_identity1,
134 tp "c0300 identity1" TC.prop_c0300_identity1,
135 tp "c1110 identity" TC.prop_c1110_identity,
136 tp "c1200 identity1" TC.prop_c1200_identity1,
137 tp "c2100 identity1" TC.prop_c2100_identity1]
138
139 p79_27_properties :: Test.Framework.Test
140 p79_27_properties =
141 testGroup "p. 79, Section (2.7) Properties" [
142 tp "c0102 identity1" TC.prop_c0102_identity1,
143 tp "c0201 identity1" TC.prop_c0201_identity1,
144 tp "c0300 identity2" TC.prop_c0300_identity2,
145 tp "c1101 identity" TC.prop_c1101_identity,
146 tp "c1200 identity2" TC.prop_c1200_identity2,
147 tp "c2100 identity2" TC.prop_c2100_identity2 ]
148
149
150 p79_28_properties :: Test.Framework.Test
151 p79_28_properties =
152 testGroup "p. 79, Section (2.8) Properties" [
153 tp "c3000 identity" TC.prop_c3000_identity,
154 tp "c2010 identity" TC.prop_c2010_identity,
155 tp "c2001 identity" TC.prop_c2001_identity,
156 tp "c1020 identity" TC.prop_c1020_identity,
157 tp "c1002 identity" TC.prop_c1002_identity,
158 tp "c1011 identity" TC.prop_c1011_identity ]
159
160
161 cube_properties :: Test.Framework.Test
162 cube_properties =
163 testGroup "Cube Properties" [
164 tp "front/back tetrahedra are disjoint" prop_front_back_tetrahedra_disjoint,
165 tp "top/down tetrahedra are disjoint" prop_top_down_tetrahedra_disjoint,
166 tp "left/right tetrahedra are disjoint" prop_left_right_tetrahedra_disjoint,
167 tp "all volumes positive" prop_all_volumes_positive,
168 tp "all volumes exact" prop_all_volumes_exact,
169 tp "v0 all equal" prop_v0_all_equal,
170 tp "interior values all identical" prop_interior_values_all_identical,
171 tp "c-tilde_2100 rotation correct" prop_c_tilde_2100_rotation_correct,
172 tp "c-tilde_2100 correct" prop_c_tilde_2100_correct ]
173
174
175 tetrahedron_properties :: Test.Framework.Test
176 tetrahedron_properties =
177 testGroup "Tetrahedron Properties" [
178 tp "b0_v0_always_unity" prop_b0_v0_always_unity,
179 tp "b0_v1_always_zero" prop_b0_v1_always_zero,
180 tp "b0_v2_always_zero" prop_b0_v2_always_zero,
181 tp "b0_v3_always_zero" prop_b0_v3_always_zero,
182 tp "b1_v1_always_unity" prop_b1_v1_always_unity,
183 tp "b1_v0_always_zero" prop_b1_v0_always_zero,
184 tp "b1_v2_always_zero" prop_b1_v2_always_zero,
185 tp "b1_v3_always_zero" prop_b1_v3_always_zero,
186 tp "b2_v2_always_unity" prop_b2_v2_always_unity,
187 tp "b2_v0_always_zero" prop_b2_v0_always_zero,
188 tp "b2_v1_always_zero" prop_b2_v1_always_zero,
189 tp "b2_v3_always_zero" prop_b2_v3_always_zero,
190 tp "b3_v3_always_unity" prop_b3_v3_always_unity,
191 tp "b3_v0_always_zero" prop_b3_v0_always_zero,
192 tp "b3_v1_always_zero" prop_b3_v1_always_zero,
193 tp "b3_v2_always_zero" prop_b3_v2_always_zero,
194 tp "swapping_vertices_doesnt_affect_coefficients1"
195 $ prop_swapping_vertices_doesnt_affect_coefficients1,
196 tp "swapping_vertices_doesnt_affect_coefficients2"
197 $ prop_swapping_vertices_doesnt_affect_coefficients2,
198 tp "swapping_vertices_doesnt_affect_coefficients3"
199 $ prop_swapping_vertices_doesnt_affect_coefficients3,
200 tp "swapping_vertices_doesnt_affect_coefficients4"
201 $ prop_swapping_vertices_doesnt_affect_coefficients4,
202 tp "x rotation doesn't affect front" prop_x_rotation_doesnt_affect_front,
203 tp "x rotation doesn't affect back" prop_x_rotation_doesnt_affect_back,
204 tp "y rotation doesn't affect left" prop_y_rotation_doesnt_affect_left,
205 tp "y rotation doesn't affect right" prop_y_rotation_doesnt_affect_right,
206 tp "z rotation doesn't affect top" prop_z_rotation_doesnt_affect_top,
207 tp "z rotation doesn't affect down" prop_z_rotation_doesnt_affect_down ]
208
209
210 -- Do the slow tests last so we can stop paying attention.
211 slow_tests :: Test.Framework.Test
212 slow_tests =
213 testGroup "Slow Tests" [
214 tp "cube indices within bounds" prop_cube_indices_never_go_out_of_bounds,
215 tc "trilinear9x9x9 reproduced" test_trilinear9x9x9_reproduced ]
216
217
218 tests :: [Test.Framework.Test]
219 tests = [ cardinal_tests,
220 function_values_tests,
221 grid_tests,
222 misc_tests,
223 tetrahedron_tests,
224 cube_properties,
225 tetrahedron_properties,
226 misc_properties,
227 cardinal_properties,
228 edge_incidence_tests,
229 p78_24_properties,
230 -- p78_25_properties,
231 p79_26_properties,
232 p79_27_properties,
233 p79_28_properties,
234 slow_tests ]