generated from mwc/project_drawing
25 lines
712 B
Python
25 lines
712 B
Python
# To run these tests run: python -m unittest tests
|
|
|
|
from unittest import TestCase
|
|
from ellipse import *
|
|
from math import sqrt
|
|
|
|
class TestEllipseFunctions(TestCase):
|
|
def test_normalize(self):
|
|
observed = normalize((0, 1))
|
|
expected = (0, 1)
|
|
self.assertEqual(observed, expected)
|
|
|
|
observed = normalize((2, 0))
|
|
expected = (1, 0)
|
|
self.assertEqual(observed, expected)
|
|
|
|
observed = normalize((1, 1))
|
|
expected = (1/sqrt(2), 1/sqrt(2))
|
|
self.assertEqual(observed, expected)
|
|
|
|
def test_project_onto_basis(self):
|
|
observed = project_onto_basis((4, 3), (4, 0))
|
|
expected = ((4, 0), (0, 3))
|
|
self.assertEqual(observed, expected)
|