mailr23152 - /trunk/test_suite/unit_tests/_lib/_geometry/test_lines.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on May 12, 2014 - 19:49:
Author: bugman
Date: Mon May 12 19:49:29 2014
New Revision: 23152

URL: http://svn.gna.org/viewcvs/relax?rev=23152&view=rev
Log:
Added 4 unit tests for the lib.geometry.lines.closest_point_ax() function.

This relax library function was previously not being checked in the test 
suite.

Modified:
    trunk/test_suite/unit_tests/_lib/_geometry/test_lines.py

Modified: trunk/test_suite/unit_tests/_lib/_geometry/test_lines.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/unit_tests/_lib/_geometry/test_lines.py?rev=23152&r1=23151&r2=23152&view=diff
==============================================================================
--- trunk/test_suite/unit_tests/_lib/_geometry/test_lines.py    (original)
+++ trunk/test_suite/unit_tests/_lib/_geometry/test_lines.py    Mon May 12 
19:49:29 2014
@@ -24,7 +24,7 @@
 from unittest import TestCase
 
 # relax module imports.
-from lib.geometry.lines import closest_point
+from lib.geometry.lines import closest_point, closest_point_ax
 
 
 class Test_lines(TestCase):
@@ -38,3 +38,43 @@
         self.assertEqual(pt[0], 0.0)
         self.assertEqual(pt[1], 0.0)
         self.assertEqual(pt[2], 0.0)
+
+
+    def test_closest_point_ax1(self):
+        """Test the closest_point_ax() function."""
+
+        # Get and check the point.
+        pt = closest_point_ax(line_pt=array([1, 1, 0], float64), 
axis=array([1, 1, 0], float64), point=array([0, 0, 10], float64))
+        self.assertAlmostEqual(pt[0], 0.0)
+        self.assertAlmostEqual(pt[1], 0.0)
+        self.assertAlmostEqual(pt[2], 0.0)
+
+
+    def test_closest_point_ax2(self):
+        """Test the closest_point_ax() function."""
+
+        # Get and check the point.
+        pt = closest_point_ax(line_pt=array([2, 2, 2], float64), 
axis=array([1, 1, 1], float64), point=array([0, 0, 0], float64))
+        self.assertAlmostEqual(pt[0], 0.0)
+        self.assertAlmostEqual(pt[1], 0.0)
+        self.assertAlmostEqual(pt[2], 0.0)
+
+
+    def test_closest_point_ax3(self):
+        """Test the closest_point_ax() function."""
+
+        # Get and check the point.
+        pt = closest_point_ax(line_pt=array([-2, -2, -2], float64), 
axis=array([1, 1, 1], float64), point=array([1, -1, 0], float64))
+        self.assertAlmostEqual(pt[0], 0.0)
+        self.assertAlmostEqual(pt[1], 0.0)
+        self.assertAlmostEqual(pt[2], 0.0)
+
+
+    def test_closest_point_ax4(self):
+        """Test the closest_point_ax() function."""
+
+        # Get and check the point.
+        pt = closest_point_ax(line_pt=array([-2, -2, 0], float64), 
axis=array([1, 1, 1], float64), point=array([1, -1, 2], float64))
+        self.assertAlmostEqual(pt[0], 0.0)
+        self.assertAlmostEqual(pt[1], 0.0)
+        self.assertAlmostEqual(pt[2], 2.0)




Related Messages


Powered by MHonArc, Updated Mon May 12 20:00:02 2014