changeset 82:c05ce6b7f941

test distance calculations
author Jeff Hammel <k0scist@gmail.com>
date Sun, 17 Dec 2017 13:45:44 -0800
parents 990a27e125f2
children 1b61ce99ee82
files tests/test_distance.py
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test_distance.py	Sun Dec 17 13:45:44 2017 -0800
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+"""
+test distance calculations
+"""
+
+import os
+import unittest
+from tvii.distance import distance
+
+class TestDistance(unittest.TestCase):
+
+    def test_triagle(self):
+        """a simple triangle"""
+
+        x = [0., 3.]
+        y = [4., 0.]
+
+        assert (distance(x, y) - 5.)**2 < 1e-6
+
+if __name__ == '__main__':
+    unittest.main()