From ea92f7319ba4350715e2397928def15f574d9d8c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 10 Jun 2011 14:25:33 -0400 Subject: [PATCH] Add six tests to ensure that the rotations don't affect faces perpendicular to them. --- src/Tests/Tetrahedron.hs | 58 ++++++++++++++++++++++++++++++++++++++++ test/TestSuite.hs | 18 +++++++++++++ 2 files changed, 76 insertions(+) diff --git a/src/Tests/Tetrahedron.hs b/src/Tests/Tetrahedron.hs index bafb7fe..159acd7 100644 --- a/src/Tests/Tetrahedron.hs +++ b/src/Tests/Tetrahedron.hs @@ -4,6 +4,7 @@ where import Test.HUnit import Test.QuickCheck +import Cardinal import Comparisons import Point import FunctionValues @@ -308,3 +309,60 @@ prop_c1110_identity t = term2 = (9/2)*(p t 1 1 1 0) term3 = (3/4)*((p t 2 1 0 0) + (p t 1 2 0 0) + (p t 2 0 1 0)) term4 = (3/4)*((p t 1 0 2 0) + (p t 0 2 1 0) + (p t 0 1 2 0)) + +prop_x_rotation_doesnt_affect_front :: Tetrahedron -> Bool +prop_x_rotation_doesnt_affect_front t = + expr1 == expr2 + where + fv0 = Tetrahedron.fv t + fv1 = rotate (Tetrahedron.fv t) cwx + expr1 = front $ fv0 + expr2 = front $ fv1 + +prop_x_rotation_doesnt_affect_back :: Tetrahedron -> Bool +prop_x_rotation_doesnt_affect_back t = + expr1 == expr2 + where + fv0 = Tetrahedron.fv t + fv1 = rotate (Tetrahedron.fv t) cwx + expr1 = back $ fv0 + expr2 = back $ fv1 + + +prop_y_rotation_doesnt_affect_left :: Tetrahedron -> Bool +prop_y_rotation_doesnt_affect_left t = + expr1 == expr2 + where + fv0 = Tetrahedron.fv t + fv1 = rotate (Tetrahedron.fv t) cwy + expr1 = left $ fv0 + expr2 = left $ fv1 + +prop_y_rotation_doesnt_affect_right :: Tetrahedron -> Bool +prop_y_rotation_doesnt_affect_right t = + expr1 == expr2 + where + fv0 = Tetrahedron.fv t + fv1 = rotate (Tetrahedron.fv t) cwy + expr1 = right $ fv0 + expr2 = right $ fv1 + + +prop_z_rotation_doesnt_affect_down :: Tetrahedron -> Bool +prop_z_rotation_doesnt_affect_down t = + expr1 == expr2 + where + fv0 = Tetrahedron.fv t + fv1 = rotate (Tetrahedron.fv t) cwz + expr1 = down $ fv0 + expr2 = down $ fv1 + + +prop_z_rotation_doesnt_affect_top :: Tetrahedron -> Bool +prop_z_rotation_doesnt_affect_top t = + expr1 == expr2 + where + fv0 = Tetrahedron.fv t + fv1 = rotate (Tetrahedron.fv t) cwz + expr1 = top $ fv0 + expr2 = top $ fv1 diff --git a/test/TestSuite.hs b/test/TestSuite.hs index 309a13c..e2fe52e 100644 --- a/test/TestSuite.hs +++ b/test/TestSuite.hs @@ -244,6 +244,24 @@ main = do putStrLn "prop_c_tilde_2100_rotation_correct... " quickCheckWith qc_args prop_c_tilde_2100_rotation_correct + putStrLn "prop_x_rotation_doesnt_affect_front... " + quickCheckWith qc_args prop_x_rotation_doesnt_affect_front + + putStrLn "prop_x_rotation_doesnt_affect_back... " + quickCheckWith qc_args prop_x_rotation_doesnt_affect_back + + putStrLn "prop_y_rotation_doesnt_affect_left... " + quickCheckWith qc_args prop_y_rotation_doesnt_affect_left + + putStrLn "prop_y_rotation_doesnt_affect_right... " + quickCheckWith qc_args prop_y_rotation_doesnt_affect_right + + putStrLn "prop_z_rotation_doesnt_affect_top... " + quickCheckWith qc_args prop_z_rotation_doesnt_affect_top + + putStrLn "prop_z_rotation_doesnt_affect_down... " + quickCheckWith qc_args prop_z_rotation_doesnt_affect_down + putStrLn "prop_c_tilde_2100_correct... " quickCheckWith qc_args prop_c_tilde_2100_correct -- 2.43.2