Package test_suite :: Package unit_tests :: Package _maths_fns :: Module test_pseudo_ellipse
[hide private]
[frames] | no frames]

Source Code for Module test_suite.unit_tests._maths_fns.test_pseudo_ellipse

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2010 Edward d'Auvergne                                        # 
 4  #                                                                             # 
 5  # This file is part of the program relax.                                     # 
 6  #                                                                             # 
 7  # relax is free software; you can redistribute it and/or modify               # 
 8  # it under the terms of the GNU General Public License as published by        # 
 9  # the Free Software Foundation; either version 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax is distributed in the hope that it will be useful,                    # 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
15  # GNU General Public License for more details.                                # 
16  #                                                                             # 
17  # You should have received a copy of the GNU General Public License           # 
18  # along with relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  # Python module imports. 
24  from math import pi 
25  from unittest import TestCase 
26   
27  # relax module imports. 
28  from maths_fns.pseudo_ellipse import pec 
29   
30   
31 -class Test_pseudo_ellipse(TestCase):
32 """Unit tests for the maths_fns.pseudo_ellipse relax module.""" 33 34
35 - def test_pec_0_0(self):
36 """Test the pec() function for x = 0, y = 0 (nothing).""" 37 38 # Check the value. 39 self.assertAlmostEqual(pec(0, 0), 0.0)
40 41
42 - def test_pec_0_1(self):
43 """Test the pec() function for x = 0, y = 1 (nothing).""" 44 45 # Check the value. 46 self.assertAlmostEqual(pec(0, 1), 0.0)
47 48
49 - def test_pec_1_0(self):
50 """Test the pec() function for x = 1, y = 0 (nothing).""" 51 52 # Check the value. 53 self.assertAlmostEqual(pec(1, 0), 0.0)
54 55
56 - def test_pec_partial1(self):
57 """Test the pec() function for x = pi/2, y = pi.""" 58 59 # Check the value. 60 self.assertAlmostEqual(pec(pi/2, pi), 9.2141334381797524)
61 62
63 - def test_pec_partial2(self):
64 """Test the pec() function for x = pi/2, y = pi/2.""" 65 66 # Check the value. 67 self.assertAlmostEqual(pec(pi/2, pi/2), 2*pi)
68 69
70 - def test_pec_partial3(self):
71 """Test the pec() function for x = pi/6, y = pi/2.""" 72 73 # Check the value. 74 self.assertAlmostEqual(pec(pi/6, pi/2), 2.3058688920532275)
75 76
77 - def test_pec_pi_pi(self):
78 """Test the pec() function for x = pi, y = pi (full sphere).""" 79 80 # Check the value. 81 self.assertAlmostEqual(pec(pi, pi), 4*pi)
82