]> gitweb.michael.orlitzky.com - spline3.git/blob - test/TestSuite.hs
Add the 'drop_z' function.
[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 Cardinal (cardinal_tests, cardinal_properties)
13 import FunctionValues (function_values_tests, function_values_properties)
14 import Grid (grid_tests, slow_tests)
15 import Misc (misc_tests, misc_properties)
16 import Tests.Cube as TC
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
29
30
31
32 tetrahedron_tests :: Test.Framework.Test
33 tetrahedron_tests =
34 testGroup "Tetrahedron Tests" [
35 tetrahedron1_geometry_tests,
36 tetrahedron2_geometry_tests,
37 containment_tests ]
38
39 -- | Defined so that my test names fit on one line.
40 tp :: Test.QuickCheck.Testable a => Test.Framework.TestName -> a -> Test.Framework.Test
41 tp = testProperty
42
43
44 p78_24_properties :: Test.Framework.Test
45 p78_24_properties =
46 testGroup "p. 78, Section (2.4) Properties" [
47 tp "c3000 identity" TT.prop_c3000_identity,
48 tp "c2100 identity" TT.prop_c2100_identity,
49 tp "c1110 identity" TT.prop_c1110_identity]
50
51 p78_25_properties :: Test.Framework.Test
52 p78_25_properties =
53 testGroup "p. 78, Section (2.5) Properties" [
54 tp "c_ijk1 identity" prop_cijk1_identity ]
55
56 edge_incidence_tests :: Test.Framework.Test
57 edge_incidence_tests =
58 testGroup "Edge Incidence Tests" [
59 tp "t0 shares edge with t6" prop_t0_shares_edge_with_t6,
60 tp "t0 shares edge with t1" prop_t0_shares_edge_with_t1,
61 tp "t0 shares edge with t3" prop_t0_shares_edge_with_t3,
62 tp "t1 shares edge with t2" prop_t1_shares_edge_with_t2,
63 tp "t1 shares edge with t19" prop_t1_shares_edge_with_t19,
64 tp "t2 shares edge with t3" prop_t2_shares_edge_with_t3,
65 tp "t2 shares edge with t12" prop_t2_shares_edge_with_t12,
66 tp "t3 shares edge with t21" prop_t3_shares_edge_with_t21,
67 tp "t4 shares edge with t5" prop_t4_shares_edge_with_t5,
68 tp "t4 shares edge with t7" prop_t4_shares_edge_with_t7,
69 tp "t4 shares edge with t10" prop_t4_shares_edge_with_t10,
70 tp "t5 shares edge with t6" prop_t5_shares_edge_with_t6,
71 tp "t5 shares edge with t16" prop_t5_shares_edge_with_t16,
72 tp "t6 shares edge with t7" prop_t6_shares_edge_with_t7,
73 tp "t7 shares edge with t20" prop_t7_shares_edge_with_t20 ]
74
75
76 p79_26_properties :: Test.Framework.Test
77 p79_26_properties =
78 testGroup "p. 79, Section (2.6) Properties" [
79 tp "c0120 identity1" TC.prop_c0120_identity1,
80 tp "c0120 identity2" TC.prop_c0120_identity2,
81 tp "c0120 identity3" TC.prop_c0120_identity3,
82 tp "c0120 identity4" TC.prop_c0120_identity4,
83 tp "c0120 identity5" TC.prop_c0120_identity5,
84 tp "c0120 identity6" TC.prop_c0120_identity6,
85 tp "c0120 identity7" TC.prop_c0120_identity7,
86 tp "c0210 identity1" TC.prop_c0210_identity1,
87 tp "c0300 identity1" TC.prop_c0300_identity1,
88 tp "c1110 identity" TC.prop_c1110_identity,
89 tp "c1200 identity1" TC.prop_c1200_identity1,
90 tp "c2100 identity1" TC.prop_c2100_identity1]
91
92 p79_27_properties :: Test.Framework.Test
93 p79_27_properties =
94 testGroup "p. 79, Section (2.7) Properties" [
95 tp "c0102 identity1" TC.prop_c0102_identity1,
96 tp "c0201 identity1" TC.prop_c0201_identity1,
97 tp "c0300 identity2" TC.prop_c0300_identity2,
98 tp "c1101 identity" TC.prop_c1101_identity,
99 tp "c1200 identity2" TC.prop_c1200_identity2,
100 tp "c2100 identity2" TC.prop_c2100_identity2 ]
101
102
103 p79_28_properties :: Test.Framework.Test
104 p79_28_properties =
105 testGroup "p. 79, Section (2.8) Properties" [
106 tp "c3000 identity" TC.prop_c3000_identity,
107 tp "c2010 identity" TC.prop_c2010_identity,
108 tp "c2001 identity" TC.prop_c2001_identity,
109 tp "c1020 identity" TC.prop_c1020_identity,
110 tp "c1002 identity" TC.prop_c1002_identity,
111 tp "c1011 identity" TC.prop_c1011_identity ]
112
113
114 cube_properties :: Test.Framework.Test
115 cube_properties =
116 testGroup "Cube Properties" [
117 tp "opposite octant tetrahedra are disjoint (1)"
118 prop_opposite_octant_tetrahedra_disjoint1,
119 tp "opposite octant tetrahedra are disjoint (2)"
120 prop_opposite_octant_tetrahedra_disjoint2,
121 tp "opposite octant tetrahedra are disjoint (3)"
122 prop_opposite_octant_tetrahedra_disjoint3,
123 tp "opposite octant tetrahedra are disjoint (4)"
124 prop_opposite_octant_tetrahedra_disjoint4,
125 tp "opposite octant tetrahedra are disjoint (5)"
126 prop_opposite_octant_tetrahedra_disjoint5,
127 tp "opposite octant tetrahedra are disjoint (6)"
128 prop_opposite_octant_tetrahedra_disjoint6,
129 tp "all volumes positive" prop_all_volumes_positive,
130 tp "all volumes exact" prop_all_volumes_exact,
131 tp "v0 all equal" prop_v0_all_equal,
132 tp "interior values all identical" prop_interior_values_all_identical,
133 tp "c-tilde_2100 rotation correct" prop_c_tilde_2100_rotation_correct,
134 tp "c-tilde_2100 correct" prop_c_tilde_2100_correct ]
135
136
137 tetrahedron_properties :: Test.Framework.Test
138 tetrahedron_properties =
139 testGroup "Tetrahedron Properties" [
140 tp "b0_v0_always_unity" prop_b0_v0_always_unity,
141 tp "b0_v1_always_zero" prop_b0_v1_always_zero,
142 tp "b0_v2_always_zero" prop_b0_v2_always_zero,
143 tp "b0_v3_always_zero" prop_b0_v3_always_zero,
144 tp "b1_v1_always_unity" prop_b1_v1_always_unity,
145 tp "b1_v0_always_zero" prop_b1_v0_always_zero,
146 tp "b1_v2_always_zero" prop_b1_v2_always_zero,
147 tp "b1_v3_always_zero" prop_b1_v3_always_zero,
148 tp "b2_v2_always_unity" prop_b2_v2_always_unity,
149 tp "b2_v0_always_zero" prop_b2_v0_always_zero,
150 tp "b2_v1_always_zero" prop_b2_v1_always_zero,
151 tp "b2_v3_always_zero" prop_b2_v3_always_zero,
152 tp "b3_v3_always_unity" prop_b3_v3_always_unity,
153 tp "b3_v0_always_zero" prop_b3_v0_always_zero,
154 tp "b3_v1_always_zero" prop_b3_v1_always_zero,
155 tp "b3_v2_always_zero" prop_b3_v2_always_zero,
156 tp "swapping_vertices_doesnt_affect_coefficients1"
157 $ prop_swapping_vertices_doesnt_affect_coefficients1,
158 tp "swapping_vertices_doesnt_affect_coefficients2"
159 $ prop_swapping_vertices_doesnt_affect_coefficients2,
160 tp "swapping_vertices_doesnt_affect_coefficients3"
161 $ prop_swapping_vertices_doesnt_affect_coefficients3,
162 tp "swapping_vertices_doesnt_affect_coefficients4"
163 $ prop_swapping_vertices_doesnt_affect_coefficients4 ]
164
165
166 tests :: [Test.Framework.Test]
167 tests = [ cardinal_tests,
168 function_values_tests,
169 grid_tests,
170 misc_tests,
171 tetrahedron_tests,
172 cube_properties,
173 tetrahedron_properties,
174 misc_properties,
175 cardinal_properties,
176 edge_incidence_tests,
177 p78_24_properties,
178 -- p78_25_properties,
179 p79_26_properties,
180 p79_27_properties,
181 p79_28_properties,
182 slow_tests ]