rename test

Mon, 22 Jan 2018 17:47:06 +0200

author
Santeri Piippo
date
Mon, 22 Jan 2018 17:47:06 +0200
changeset 20
db2300032678
parent 19
9169bad392c4
child 21
8006fb8cdb77

rename test

tests/concave.py file | annotate | diff | comparison | revisions
tests/quadrilaterals.py file | annotate | diff | comparison | revisions
--- a/tests/concave.py	Mon Jan 22 17:46:48 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-from math import acos, degrees, radians, pi as π
-from testsuite import warning, error
-from geometry import *
-
-def sign_consistency(container):
-    # Returns whether all elements in container have the same sign
-    return min(container) * max(container) >= 0
-
-def concave_test(model):
-    for quadrilateral in model.quadrilaterals:
-        geometry = transform_to_xy(quadrilateral.geometry)
-        z_scores = [
-            cross_product(v2 - v1, v3 - v1).z
-            for v1, v2, v3 in pairs(geometry.vertices, count = 3)
-        ]
-        if not sign_consistency(z_scores):
-            yield error(quadrilateral, 'concave-error')
-
-def skew_test(model):
-    ''' Test for non-coplanar quadrilaterals. '''
-    for quadrilateral in model.quadrilaterals:
-        for triangles in split_quadrilateral(quadrilateral.geometry):
-            plane_1 = triangle_plane_normal(triangles[0])
-            plane_2 = triangle_plane_normal(triangles[1])
-            skew_angle = vector_angle(plane_1, plane_2, normalized = True)
-            if skew_angle > radians(0.1):
-                yield error(quadrilateral, 'skew-error',
-                    skew_angle = skew_angle,
-                )
-                break
-
-manifest = {
-    'tests': {
-        'skew': skew_test,
-        'concave': concave_test,
-    },
-    'messages': {
-        'skew-error': lambda skew_angle:
-            str.format('skew quadrilateral (plane angle {}°)',
-                '%.2f' % degrees(skew_angle),
-            ),
-        'concave-error': 'concave quadrilateral',
-    },
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/quadrilaterals.py	Mon Jan 22 17:47:06 2018 +0200
@@ -0,0 +1,44 @@
+from math import acos, degrees, radians, pi as π
+from testsuite import warning, error
+from geometry import *
+
+def sign_consistency(container):
+    # Returns whether all elements in container have the same sign
+    return min(container) * max(container) >= 0
+
+def concave_test(model):
+    for quadrilateral in model.quadrilaterals:
+        geometry = transform_to_xy(quadrilateral.geometry)
+        z_scores = [
+            cross_product(v2 - v1, v3 - v1).z
+            for v1, v2, v3 in pairs(geometry.vertices, count = 3)
+        ]
+        if not sign_consistency(z_scores):
+            yield error(quadrilateral, 'concave-error')
+
+def skew_test(model):
+    ''' Test for non-coplanar quadrilaterals. '''
+    for quadrilateral in model.quadrilaterals:
+        for triangles in split_quadrilateral(quadrilateral.geometry):
+            plane_1 = triangle_plane_normal(triangles[0])
+            plane_2 = triangle_plane_normal(triangles[1])
+            skew_angle = vector_angle(plane_1, plane_2, normalized = True)
+            if skew_angle > radians(0.1):
+                yield error(quadrilateral, 'skew-error',
+                    skew_angle = skew_angle,
+                )
+                break
+
+manifest = {
+    'tests': {
+        'skew': skew_test,
+        'concave': concave_test,
+    },
+    'messages': {
+        'skew-error': lambda skew_angle:
+            str.format('skew quadrilateral (plane angle {}°)',
+                '%.2f' % degrees(skew_angle),
+            ),
+        'concave-error': 'concave quadrilateral',
+    },
+}

mercurial