summaryrefslogtreecommitdiff
path: root/cad/tests/VQT_Test.py
blob: e53e1e9ae02c0bf1c123ec7f2a021900e802f8f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

import unittest
from VQT import angleBetween
from Numeric import array, alltrue


class GeometryFunctionsTestCase(unittest.TestCase):
    """Unit tests for the geometry functions defined in VQT.py"""

    def setUp(self):
        """Sets up any objects needed by this test case."""
        pass

    
    def tearDown(self):
        """Releases any resources used by this test case."""
        pass

    
    def testAngleBetween(self):
        vector1 = array((1, 0, 0))
        vector2 = array((0, 1, 0))
        angle = angleBetween(vector1, vector2)
        assert angle == 90, "Fails sanity check"
        assert alltrue(vector1 == array((1, 0, 0))) and \
               alltrue(vector2 == array((0, 1, 0))), \
               "Arguments were modified (recurrence of bug ####)"

               
if __name__ == "__main__":
    unittest.main() # Run all tests whose names begin with 'test'