merged the drivers, and am investigating the qdelauney manpage ... should've done this earlier :P
--HG-- rename : bin/driver-random.py => bin/driver.py rename : test/utest.py => test/qhull.test.py
This commit is contained in:
+21
-25
@@ -1,33 +1,29 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
|
||||
import random
|
||||
import unittest
|
||||
import delaunay
|
||||
import subprocess
|
||||
|
||||
QFILE = '/tmp/forQhull.txt'
|
||||
class TestSequenceFunctions(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.l = [[-1, 1], [-1, 0], [-1, 1], [0, -1], [0, 0], [0, 1], [1, -1], [1, 0], [1, 1]]
|
||||
|
||||
l = [[-1, 1], [-1, 0], [-1, 1], [0, -1], [0, 0], [0, 1], [1, -1], [1, 0], [1, 1]]
|
||||
|
||||
qdelauney_file = open(QFILE, 'w')
|
||||
def testQhull(self):
|
||||
dt = delaunay.Triangulation(self.l)
|
||||
answer = [
|
||||
[4,1,3],
|
||||
[1,5,0],
|
||||
[5,1,4],
|
||||
[7,3,6],
|
||||
[7,4,3],
|
||||
[7,5,4],
|
||||
[5,7,8],
|
||||
]
|
||||
|
||||
qdelauney_file.write("%d\n" % len(l[0]))
|
||||
qdelauney_file.write("%d\n" % len(l))
|
||||
for i in l:
|
||||
qdelauney_file.write("%0.3f %0.3f\n" % (i[0], i[1]))
|
||||
self.assertEqual(dt.indices, answer)
|
||||
|
||||
dt = delaunay.Triangulation(l)
|
||||
print dt.indices
|
||||
|
||||
answer = [
|
||||
[4,1,3],
|
||||
[1,5,0],
|
||||
[5,1,4],
|
||||
[7,3,6],
|
||||
[7,4,3],
|
||||
[7,5,4],
|
||||
[5,7,8],
|
||||
]
|
||||
|
||||
print answer == dt.indices
|
||||
print dt.indices
|
||||
|
||||
print "now run /usr/bin/qdelaunay Qt i < %s" % QFILE
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions)
|
||||
unittest.TextTestRunner(verbosity=5).run(suite)
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
|
||||
import random
|
||||
import unittest
|
||||
import delaunay
|
||||
|
||||
class TestSequenceFunctions(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.l = [[-1, 1], [-1, 0], [-1, 1], [0, -1], [0, 0], [0, 1], [1, -1], [1, 0], [1, 1]]
|
||||
|
||||
|
||||
def testQhull(self):
|
||||
dt = delaunay.Triangulation(self.l)
|
||||
answer = [
|
||||
[4,1,3],
|
||||
[1,5,0],
|
||||
[5,1,4],
|
||||
[7,3,6],
|
||||
[7,4,3],
|
||||
[7,5,4],
|
||||
[5,7,8],
|
||||
]
|
||||
|
||||
self.assertEqual(dt.indices, answer)
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions)
|
||||
unittest.TextTestRunner(verbosity=5).run(suite)
|
||||
Reference in New Issue
Block a user