forgot to add the file I said I added a few changesets ago
This commit is contained in:
parent
12e82529a2
commit
84712d5613
0
test/__init__.py
Normal file
0
test/__init__.py
Normal file
35
test/vertex.py
Normal file
35
test/vertex.py
Normal file
@ -0,0 +1,35 @@
|
||||
import unittest
|
||||
|
||||
from surf.geometry import Vertex
|
||||
|
||||
|
||||
class TestVertexOperations(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.origin = Vertex(0, 0, 0)
|
||||
self.v1 = Vertex(-1, -1, -1)
|
||||
self.v2 = Vertex(1, 1, 1)
|
||||
|
||||
self.v3 = Vertex(5, 4, 3)
|
||||
self.v4 = Vertex(10, -2, 13)
|
||||
self.v5 = Vertex(-4, 15.3, 100)
|
||||
|
||||
def test_addition(self):
|
||||
added_v = self.v1 + self.v2
|
||||
self.assertEqual(added_v, self.origin)
|
||||
self.assertEqual(self.v3 + self.v4, Vertex(15, 2, 16))
|
||||
|
||||
def test_summation(self):
|
||||
v = sum((self.v1, self.v2, self.v3, self.v4), Vertex())
|
||||
self.assertEqual(v, Vertex(15, 2, 16))
|
||||
v = sum((self.v1, self.v2, self.v3, self.v4, self.v5), Vertex())
|
||||
self.assertEqual(v, Vertex(11, 17.3, 116))
|
||||
|
||||
def test_division(self):
|
||||
v1 = self.v1 / 2
|
||||
v2 = self.v1 / 2.0
|
||||
self.assertEqual(v1, v2)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=3)
|
Loading…
Reference in New Issue
Block a user