]> gitweb.michael.orlitzky.com - spline3.git/blob - test/TestSuite.hs
Move the Grid tests into the Grid module.
[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 "front/back tetrahedra are disjoint" prop_front_back_tetrahedra_disjoint,
118 tp "top/down tetrahedra are disjoint" prop_top_down_tetrahedra_disjoint,
119 tp "left/right tetrahedra are disjoint" prop_left_right_tetrahedra_disjoint,
120 tp "all volumes positive" prop_all_volumes_positive,
121 tp "all volumes exact" prop_all_volumes_exact,
122 tp "v0 all equal" prop_v0_all_equal,
123 tp "interior values all identical" prop_interior_values_all_identical,
124 tp "c-tilde_2100 rotation correct" prop_c_tilde_2100_rotation_correct,
125 tp "c-tilde_2100 correct" prop_c_tilde_2100_correct ]
126
127
128 tetrahedron_properties :: Test.Framework.Test
129 tetrahedron_properties =
130 testGroup "Tetrahedron Properties" [
131 tp "b0_v0_always_unity" prop_b0_v0_always_unity,
132 tp "b0_v1_always_zero" prop_b0_v1_always_zero,
133 tp "b0_v2_always_zero" prop_b0_v2_always_zero,
134 tp "b0_v3_always_zero" prop_b0_v3_always_zero,
135 tp "b1_v1_always_unity" prop_b1_v1_always_unity,
136 tp "b1_v0_always_zero" prop_b1_v0_always_zero,
137 tp "b1_v2_always_zero" prop_b1_v2_always_zero,
138 tp "b1_v3_always_zero" prop_b1_v3_always_zero,
139 tp "b2_v2_always_unity" prop_b2_v2_always_unity,
140 tp "b2_v0_always_zero" prop_b2_v0_always_zero,
141 tp "b2_v1_always_zero" prop_b2_v1_always_zero,
142 tp "b2_v3_always_zero" prop_b2_v3_always_zero,
143 tp "b3_v3_always_unity" prop_b3_v3_always_unity,
144 tp "b3_v0_always_zero" prop_b3_v0_always_zero,
145 tp "b3_v1_always_zero" prop_b3_v1_always_zero,
146 tp "b3_v2_always_zero" prop_b3_v2_always_zero,
147 tp "swapping_vertices_doesnt_affect_coefficients1"
148 $ prop_swapping_vertices_doesnt_affect_coefficients1,
149 tp "swapping_vertices_doesnt_affect_coefficients2"
150 $ prop_swapping_vertices_doesnt_affect_coefficients2,
151 tp "swapping_vertices_doesnt_affect_coefficients3"
152 $ prop_swapping_vertices_doesnt_affect_coefficients3,
153 tp "swapping_vertices_doesnt_affect_coefficients4"
154 $ prop_swapping_vertices_doesnt_affect_coefficients4 ]
155
156
157 tests :: [Test.Framework.Test]
158 tests = [ cardinal_tests,
159 function_values_tests,
160 grid_tests,
161 misc_tests,
162 tetrahedron_tests,
163 cube_properties,
164 tetrahedron_properties,
165 misc_properties,
166 cardinal_properties,
167 edge_incidence_tests,
168 p78_24_properties,
169 -- p78_25_properties,
170 p79_26_properties,
171 p79_27_properties,
172 p79_28_properties,
173 slow_tests ]