]> gitweb.michael.orlitzky.com - spline3.git/commitdiff
Finish migrating the QuickCheck tests to test-framework.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 8 Jul 2011 12:05:24 +0000 (08:05 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 8 Jul 2011 12:05:24 +0000 (08:05 -0400)
test/TestSuite.hs

index 3d71f7d26983151cfb9e0c0400ac38f819c41ec3..7fc5079329b9b8b5278ca100c943e53359069240 100644 (file)
@@ -1,8 +1,8 @@
-import Test.Framework (defaultMain, testGroup, Test, TestName)
+import Test.Framework (defaultMain, testGroup, Test, TestName, TestOptions(..))
 import Test.Framework.Providers.HUnit
 import Test.Framework.Providers.QuickCheck2 (testProperty)
 import Test.HUnit
-import Test.QuickCheck
+import Test.QuickCheck (Testable ())
 
 import Tests.Cardinal
 import Tests.Cube as TC
@@ -24,109 +24,7 @@ main = do
   putStrLn "-----"
   runTestTT test_suite
   putStrLn ""
-  putStrLn "QuickCheck"
-  putStrLn "----------"
-  let qc_args = stdArgs { maxSuccess = 100,
-                          maxDiscard = 500,
-                          maxSize = 100 }
-
-
-  -- putStrLn "\np. 78, (2.5)\n"
-
-  -- putStr "prop_cijk1_identity... "
-  -- quickCheckWith qc_args prop_cijk1_identity
-
-
-  putStr "prop_interior_values_all_identical... "
-  quickCheckWith qc_args prop_interior_values_all_identical
-
-  putStr "prop_c_tilde_2100_rotation_correct... "
-  quickCheckWith qc_args prop_c_tilde_2100_rotation_correct
-
-  putStr "prop_x_rotation_doesnt_affect_front... "
-  quickCheckWith qc_args prop_x_rotation_doesnt_affect_front
-
-  putStr "prop_x_rotation_doesnt_affect_back... "
-  quickCheckWith qc_args prop_x_rotation_doesnt_affect_back
-
-  putStr "prop_y_rotation_doesnt_affect_left... "
-  quickCheckWith qc_args prop_y_rotation_doesnt_affect_left
-
-  putStr "prop_y_rotation_doesnt_affect_right... "
-  quickCheckWith qc_args prop_y_rotation_doesnt_affect_right
-
-  putStr "prop_z_rotation_doesnt_affect_top... "
-  quickCheckWith qc_args prop_z_rotation_doesnt_affect_top
-
-  putStr "prop_z_rotation_doesnt_affect_down... "
-  quickCheckWith qc_args prop_z_rotation_doesnt_affect_down
-
-  putStr "prop_c_tilde_2100_correct... "
-  quickCheckWith qc_args prop_c_tilde_2100_correct
-
-
-  putStrLn "\nTetrahedron Tests\n"
-
-  putStr "prop_b0_v0_always_unity... "
-  quickCheckWith qc_args prop_b0_v0_always_unity
-
-  putStr "prop_b0_v1_always_zero... "
-  quickCheckWith qc_args prop_b0_v1_always_zero
-
-  putStr "prop_b0_v2_always_zero... "
-  quickCheckWith qc_args prop_b0_v2_always_zero
-
-  putStr "prop_b0_v3_always_zero... "
-  quickCheckWith qc_args prop_b0_v3_always_zero
-
-  putStr "prop_b1_v1_always_unity... "
-  quickCheckWith qc_args prop_b1_v1_always_unity
-
-  putStr "prop_b1_v0_always_zero... "
-  quickCheckWith qc_args prop_b1_v0_always_zero
-
-  putStr "prop_b1_v2_always_zero... "
-  quickCheckWith qc_args prop_b1_v2_always_zero
-
-  putStr "prop_b1_v3_always_zero... "
-  quickCheckWith qc_args prop_b1_v3_always_zero
-
-  putStr "prop_b2_v2_always_unity... "
-  quickCheckWith qc_args prop_b2_v2_always_unity
-
-  putStr "prop_b2_v0_always_zero... "
-  quickCheckWith qc_args prop_b2_v0_always_zero
-
-  putStr "prop_b2_v1_always_zero... "
-  quickCheckWith qc_args prop_b2_v1_always_zero
-
-  putStr "prop_b2_v3_always_zero... "
-  quickCheckWith qc_args prop_b2_v3_always_zero
-
-  putStr "prop_b3_v3_always_unity... "
-  quickCheckWith qc_args prop_b3_v3_always_unity
-
-  putStr "prop_b3_v0_always_zero... "
-  quickCheckWith qc_args prop_b3_v0_always_zero
-
-  putStr "prop_b3_v1_always_zero... "
-  quickCheckWith qc_args prop_b3_v1_always_zero
-
-  putStr "prop_b3_v2_always_zero... "
-  quickCheckWith qc_args prop_b3_v2_always_zero
-
-  putStr "prop_swapping_vertices_doesnt_affect_coefficients1... "
-  quickCheckWith qc_args prop_swapping_vertices_doesnt_affect_coefficients1
-
-  putStr "prop_swapping_vertices_doesnt_affect_coefficients2... "
-  quickCheckWith qc_args prop_swapping_vertices_doesnt_affect_coefficients2
-
-  putStr "prop_swapping_vertices_doesnt_affect_coefficients3... "
-  quickCheckWith qc_args prop_swapping_vertices_doesnt_affect_coefficients3
-
-  putStr "prop_swapping_vertices_doesnt_affect_coefficients4... "
-  quickCheckWith qc_args prop_swapping_vertices_doesnt_affect_coefficients4
-
+  
   defaultMain tests
               
   return ()
@@ -171,6 +69,10 @@ p78_24_properties =
       tp "c2100 identity" TT.prop_c2100_identity,
       tp "c1110 _identity" TT.prop_c1110_identity]
 
+p78_25_properties :: Test.Framework.Test
+p78_25_properties =
+    testGroup "p. 78, Section (2.5) Properties" [
+      tp "c_ijk1 identity" prop_cijk1_identity ]
 
 edge_incidence_tests :: Test.Framework.Test
 edge_incidence_tests =
@@ -284,15 +186,54 @@ cube_properties =
   tp "tetrahedron21 volumes positive" prop_tetrahedron21_volumes_positive,
   tp "tetrahedron22 volumes positive" prop_tetrahedron22_volumes_positive,
   tp "tetrahedron23 volumes positive" prop_tetrahedron23_volumes_positive,
-  tp "v0 all equal" prop_v0_all_equal ]
-
+  tp "v0 all equal" prop_v0_all_equal,
+  tp "interior values all identical" prop_interior_values_all_identical,
+  tp "c-tilde_2100 rotation correct" prop_c_tilde_2100_rotation_correct,
+  tp "c-tilde_2100 correct" prop_c_tilde_2100_correct ]
+
+
+tetrahedron_properties :: Test.Framework.Test
+tetrahedron_properties =
+    testGroup "Tetrahedron Properties" [
+      tp "b0_v0_always_unity" prop_b0_v0_always_unity,
+      tp "b0_v1_always_zero" prop_b0_v1_always_zero,
+      tp "b0_v2_always_zero" prop_b0_v2_always_zero,
+      tp "b0_v3_always_zero" prop_b0_v3_always_zero,
+      tp "b1_v1_always_unity" prop_b1_v1_always_unity,
+      tp "b1_v0_always_zero" prop_b1_v0_always_zero,
+      tp "b1_v2_always_zero" prop_b1_v2_always_zero,
+      tp "b1_v3_always_zero" prop_b1_v3_always_zero,
+      tp "b2_v2_always_unity" prop_b2_v2_always_unity,
+      tp "b2_v0_always_zero" prop_b2_v0_always_zero,
+      tp "b2_v1_always_zero" prop_b2_v1_always_zero,
+      tp "b2_v3_always_zero" prop_b2_v3_always_zero,
+      tp "b3_v3_always_unity" prop_b3_v3_always_unity,
+      tp "b3_v0_always_zero" prop_b3_v0_always_zero,
+      tp "b3_v1_always_zero" prop_b3_v1_always_zero,
+      tp "b3_v2_always_zero" prop_b3_v2_always_zero,
+      tp "swapping_vertices_doesnt_affect_coefficients1"
+         $ prop_swapping_vertices_doesnt_affect_coefficients1,
+      tp "swapping_vertices_doesnt_affect_coefficients2"
+         $ prop_swapping_vertices_doesnt_affect_coefficients2,
+      tp "swapping_vertices_doesnt_affect_coefficients3"
+         $ prop_swapping_vertices_doesnt_affect_coefficients3,
+      tp "swapping_vertices_doesnt_affect_coefficients4"
+         $ prop_swapping_vertices_doesnt_affect_coefficients4,
+      tp "x rotation doesn't affect front" prop_x_rotation_doesnt_affect_front,
+      tp "x rotation doesn't affect back" prop_x_rotation_doesnt_affect_back,
+      tp "y rotation doesn't affect left" prop_y_rotation_doesnt_affect_left,
+      tp "y rotation doesn't affect right" prop_y_rotation_doesnt_affect_right,
+      tp "z rotation doesn't affect top" prop_z_rotation_doesnt_affect_top,
+      tp "z rotation doesn't affect down" prop_z_rotation_doesnt_affect_down ]
                  
 tests :: [Test.Framework.Test]
 tests = [ cube_properties,
+          tetrahedron_properties,
           misc_properties,          
           cardinal_properties,
           edge_incidence_tests,
           p78_24_properties,
+--          p78_25_properties,
           p79_26_properties,
           p79_27_properties,
           p79_28_properties ]