]> gitweb.michael.orlitzky.com - spline3.git/commitdiff
Add six tests to ensure that the rotations don't affect faces perpendicular to them.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 10 Jun 2011 18:25:33 +0000 (14:25 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 10 Jun 2011 18:25:33 +0000 (14:25 -0400)
src/Tests/Tetrahedron.hs
test/TestSuite.hs

index bafb7fe2e5a9afdb793df41930d84cd4cd21f566..159acd7f95bdb11a4a583c994fcd7a0ed350a2ee 100644 (file)
@@ -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
index 309a13c9815c74d3ff74158065dfcb1139b46b55..e2fe52ec87be76b2a514ae1a46b6c3caae2fae80 100644 (file)
@@ -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