From 2064e9a7da32813c6dce843127e2306b841df353 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 7 May 2011 23:56:37 -0400 Subject: [PATCH] Try to re-enable some more tests; fail miserably. --- src/Tests/Cube.hs | 33 ++++++++++++++++++++++++++++++++- src/Tests/Face.hs | 27 --------------------------- test/TestSuite.hs | 36 ++++++++++++++++++------------------ 3 files changed, 50 insertions(+), 46 deletions(-) diff --git a/src/Tests/Cube.hs b/src/Tests/Cube.hs index 5485046..26d4d33 100644 --- a/src/Tests/Cube.hs +++ b/src/Tests/Cube.hs @@ -1,13 +1,16 @@ module Tests.Cube where +import Debug.Trace (trace) import Test.QuickCheck import Comparisons import Cube import FunctionValues (FunctionValues) import Tests.FunctionValues () -import Tetrahedron (v0, volume) +import Tetrahedron (b0, b1, b2, b3, c, + Tetrahedron(Tetrahedron), + v0, v1, v2, v3, volume) instance Arbitrary Cube where arbitrary = do @@ -258,3 +261,31 @@ prop_tetrahedron22_volumes_positive c = prop_tetrahedron23_volumes_positive :: Cube -> Bool prop_tetrahedron23_volumes_positive c = volume (tetrahedron23 c) > 0 + + +-- | Given in Sorokina and Zeilfelder, p. 79. +--prop_c0120_identity1 :: Cube -> Bool +--prop_c0120_identity1 cube = +-- c0 ~= (c1 + c2) / 2 +-- where +-- c0 = trace ("c0 :" ++ (show (c t0 0 1 2 0))) (c t0 0 1 2 0) +-- c1 = trace ("c1 :" ++ (show (c t0 0 0 2 1))) (c t0 0 0 2 1) +-- c2 = trace ("c2 :" ++ (show (c t1 0 0 2 1))) (c t1 0 0 2 1) +-- t0 = tetrahedron0 cube +-- t1 = tetrahedron1 cube + + +-- | Given in Sorokina and Zeilfelder, p. 78. +-- prop_cijk1_identity :: Cube -> Bool +-- prop_cijk1_identity cube = +-- and [ c t0 i j k 1 ~= +-- (c t1 (i+1) j k 0) * ((b0 t0) (v3 t1)) + +-- (c t1 i (j+1) k 0) * ((b1 t0) (v3 t1)) + +-- (c t1 i j (k+1) 0) * ((b2 t0) (v3 t1)) + +-- (c t1 i j k 1) * ((b3 t0) (v3 t1)) | i <- [0..2], +-- j <- [0..2], +-- k <- [0..2], +-- i + j + k == 2] +-- where +-- t0 = tetrahedron0 cube +-- t1 = tetrahedron1 cube diff --git a/src/Tests/Face.hs b/src/Tests/Face.hs index 0d1bda7..5e5b4c2 100644 --- a/src/Tests/Face.hs +++ b/src/Tests/Face.hs @@ -1,33 +1,6 @@ module Tests.Face where --- -- | Given in Sorokina and Zeilfelder, p. 78. --- prop_cijk1_identity :: Cube -> Bool --- prop_cijk1_identity cube = --- and [ c t0' i j k 1 ~= (c t1' (i+1) j k 0) * ((b0 t0') (v3 t1')) + --- (c t1' i (j+1) k 0) * ((b1 t0') (v3 t1')) + --- (c t1' i j (k+1) 0) * ((b2 t0') (v3 t1')) + --- (c t1' i j k 1) * ((b3 t0') (v3 t1')) | i <- [0..2], --- j <- [0..2], --- k <- [0..2], --- i + j + k == 2] --- where --- t0 = tetrahedron0 (face0 cube) --- t1 = tetrahedron1 (face0 cube) --- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0) --- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1) - --- -- | Given in Sorokina and Zeilfelder, p. 79. --- prop_c0120_identity1 :: Cube -> Bool --- prop_c0120_identity1 cube = --- c t0' 0 1 2 0 ~= (c t0' 0 0 2 1 + c t1' 0 0 2 1) / 2 --- where --- t0 = tetrahedron0 (face0 cube) --- t1 = tetrahedron1 (face0 cube) --- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0) --- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1) - - -- -- | Given in Sorokina and Zeilfelder, p. 79. -- prop_c0210_identity1 :: Cube -> Bool -- prop_c0210_identity1 cube = diff --git a/test/TestSuite.hs b/test/TestSuite.hs index 48493f8..ce386db 100644 --- a/test/TestSuite.hs +++ b/test/TestSuite.hs @@ -3,14 +3,12 @@ import Test.QuickCheck import Tests.Cardinal import Tests.Cube -import Tests.Face as TF -import Tests.Grid as TG +import Tests.Grid import Tests.Misc import Tests.Tetrahedron as TT -- The list of HUnit tests. -test_suite = TestList (concat [face_tests, - grid_tests, +test_suite = TestList (concat [grid_tests, misc_tests, tetrahedron_tests]) @@ -31,6 +29,9 @@ main = do putStrLn "\nCube Tests\n" + -- putStr "prop_c0120_identity1... " + -- quickCheckWith qc_args prop_c0120_identity1 + putStr "prop_all_volumes_positive... " quickCheckWith qc_args prop_all_volumes_positive @@ -136,6 +137,12 @@ main = do putStr "prop_v0_all_equal... " quickCheckWith qc_args prop_v0_all_equal +-- putStrLn "\np. 78, (2.5)\n" + +-- putStr "prop_cijk1_identity... " +-- quickCheckWith qc_args prop_cijk1_identity + + putStrLn "\nMisc Tests\n" putStr "prop_factorial_greater... " @@ -191,26 +198,19 @@ main = do putStr "prop_b3_v2_always_zero... " quickCheckWith qc_args prop_b3_v2_always_zero - -- putStrLn "\np. 78, (2.4)\n" + putStrLn "\np. 78, (2.4)\n" - -- putStr "prop_c3000_identity... " - -- quickCheckWith qc_args TT.prop_c3000_identity - - -- putStr "prop_c2100_identity... " - -- quickCheckWith qc_args TT.prop_c2100_identity + putStr "prop_c3000_identity... " + quickCheckWith qc_args TT.prop_c3000_identity - -- putStr "prop_c1110_identity... " - -- quickCheckWith qc_args TT.prop_c1110_identity + putStr "prop_c2100_identity... " + quickCheckWith qc_args TT.prop_c2100_identity - -- putStrLn "\np. 78, (2.5)\n" + putStr "prop_c1110_identity... " + quickCheckWith qc_args TT.prop_c1110_identity - -- putStr "prop_cijk1_identity... " - -- quickCheckWith qc_args prop_cijk1_identity -- putStrLn "\np. 79, (2.6)\n" - -- putStr "prop_c0120_identity1... " - -- quickCheckWith qc_args TF.prop_c0120_identity1 - -- putStr "prop_c0210_identity1... " -- quickCheckWith qc_args TF.prop_c0210_identity1 -- 2.43.2