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