Author: bugman Date: Mon Nov 17 17:29:14 2014 New Revision: 26605 URL: http://svn.gna.org/viewcvs/relax?rev=26605&view=rev Log: Added 6 unit tests for the lib.geometry.vectors.vector_angle_acos() function. These are similar to those of the vector_angle_normal() function but unsigned angles are checked for. Modified: trunk/test_suite/unit_tests/_lib/_geometry/test_vectors.py Modified: trunk/test_suite/unit_tests/_lib/_geometry/test_vectors.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/unit_tests/_lib/_geometry/test_vectors.py?rev=26605&r1=26604&r2=26605&view=diff ============================================================================== --- trunk/test_suite/unit_tests/_lib/_geometry/test_vectors.py (original) +++ trunk/test_suite/unit_tests/_lib/_geometry/test_vectors.py Mon Nov 17 17:29:14 2014 @@ -25,11 +25,83 @@ from unittest import TestCase # relax module imports. -from lib.geometry.vectors import vector_angle_normal +from lib.geometry.vectors import vector_angle_acos, vector_angle_normal class Test_vectors(TestCase): """Unit tests for the lib.geometry.vectors relax module.""" + + def test_vector_angle_acos_1(self): + """Test the vector_angle_acos() function with the vectors [1, 0, 0] and [0, 1, 0].""" + + # Calculate the angle. + v1 = array([1, 0, 0], float64) + v2 = array([0, 1, 0], float64) + angle = vector_angle_acos(v1, v2) + + # Check the angle. + self.assertAlmostEqual(angle, pi/2.0) + + + def test_vector_angle_acos_2(self): + """Test the vector_angle_acos() function with the vectors [1, 0, 0] and [0, 2, 0].""" + + # Calculate the angle. + v1 = array([1, 0, 0], float64) + v2 = array([0, 2, 0], float64) + angle = vector_angle_acos(v1, v2) + + # Check the angle. + self.assertAlmostEqual(angle, pi/2.0) + + + def test_vector_angle_acos_3(self): + """Test the vector_angle_acos() function with the vectors [2, 0, 0] and [0, -2, 0].""" + + # Calculate the angle. + v1 = array([2, 0, 0], float64) + v2 = array([0, -2, 0], float64) + angle = vector_angle_acos(v1, v2) + + # Check the angle. + self.assertAlmostEqual(angle, pi/2.0) + + + def test_vector_angle_acos_4(self): + """Test the vector_angle_acos() function with the vectors [2, 0, 0] and [2, 2, 0].""" + + # Calculate the angle. + v1 = array([2, 0, 0], float64) + v2 = array([2, 2, 0], float64) + angle = vector_angle_acos(v1, v2) + + # Check the angle. + self.assertAlmostEqual(angle, pi/4.0) + + + def test_vector_angle_acos_5(self): + """Test the vector_angle_acos() function with the vectors [2, 0, 0] and [2, 2, 0].""" + + # Calculate the angle. + v1 = array([2, 0, 0], float64) + v2 = array([2, 2, 0], float64) + angle = vector_angle_acos(v1, v2) + + # Check the angle. + self.assertAlmostEqual(angle, pi/4.0) + + + def test_vector_angle_acos_6(self): + """Test the vector_angle_acos() function with the vectors [2, 2, 0] and [2, -2, 0].""" + + # Calculate the angle. + v1 = array([2, 2, 0], float64) + v2 = array([2, -2, 0], float64) + angle = vector_angle_acos(v1, v2) + + # Check the angle. + self.assertAlmostEqual(angle, pi/2.0) + def test_vector_angle_normal1(self): """Test the vector_angle_normal() function with the vectors [1, 0, 0] and [0, 1, 0]."""