summaryrefslogtreecommitdiff
path: root/cad/tests/VQT_Test.py
blob: 929a5d88909ed4108365488dcc8f0d226d0b9f19 (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'