made it so I can call all tests at once

--HG--
rename : test/2dcubic.py => test/cubic2d.py
rename : test/2dquadratic.py => test/quadratic2d.py
This commit is contained in:
Stephen McQuay 2011-02-15 11:27:45 -07:00
parent 6bc5908a9b
commit 9827035e72
8 changed files with 40 additions and 14 deletions

26
test/all.py Normal file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env python
import unittest
import baker2dorder
import baker2d
import baker3d
import cubic2d
import pattern
import qhull
import quadratic2d
if __name__ == '__main__':
tests = [
unittest.TestLoader().loadTestsFromTestCase(baker2dorder.Test),
unittest.TestLoader().loadTestsFromTestCase(baker2d.Test),
unittest.TestLoader().loadTestsFromTestCase(baker3d.Test),
unittest.TestLoader().loadTestsFromTestCase(cubic2d.Test),
unittest.TestLoader().loadTestsFromTestCase(pattern.Test),
unittest.TestLoader().loadTestsFromTestCase(qhull.Test),
unittest.TestLoader().loadTestsFromTestCase(quadratic2d.Test),
]
for test in tests:
unittest.TextTestRunner(verbosity=3).run(test)

4
test/baker2d.py Executable file → Normal file
View File

@ -8,7 +8,7 @@ from interp import grid
import numpy as np import numpy as np
import scipy.spatial import scipy.spatial
class TestSequenceFunctions(unittest.TestCase): class Test(unittest.TestCase):
def setUp(self): def setUp(self):
self.l = [[-1, 1], [-1, 0], [-1, 1], [0, -1], [0, 0], [0, 1], [1, -1], [1, 0], [1, 1]] self.l = [[-1, 1], [-1, 0], [-1, 1], [0, -1], [0, 0], [0, 1], [1, -1], [1, 0], [1, 1]]
self.all_points = [ self.all_points = [
@ -153,5 +153,5 @@ class TestSequenceFunctions(unittest.TestCase):
self.assertAlmostEqual(c, cc) self.assertAlmostEqual(c, cc)
if __name__ == '__main__': if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions) suite = unittest.TestLoader().loadTestsFromTestCase(Test)
unittest.TextTestRunner(verbosity=3).run(suite) unittest.TextTestRunner(verbosity=3).run(suite)

4
test/baker2dorder.py Executable file → Normal file
View File

@ -32,7 +32,7 @@ def calculate_error_term(self, a,b,c,d,e,f):
abc[2] * self.phis[e] * self.phis[f] abc[2] * self.phis[e] * self.phis[f]
return err return err
class TestSequenceFunctions(unittest.TestCase): class Test(unittest.TestCase):
def setUp(self): def setUp(self):
self.verts = [ self.verts = [
[ 2, 3], # 0 [ 2, 3], # 0
@ -100,5 +100,5 @@ class TestSequenceFunctions(unittest.TestCase):
if __name__ == '__main__': if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions) suite = unittest.TestLoader().loadTestsFromTestCase(Test)
unittest.TextTestRunner(verbosity=3).run(suite) unittest.TextTestRunner(verbosity=3).run(suite)

4
test/baker3d.py Executable file → Normal file
View File

@ -7,7 +7,7 @@ from interp.grid import grid
import numpy as np import numpy as np
import scipy.spatial import scipy.spatial
class TestSequenceFunctions(unittest.TestCase): class Test(unittest.TestCase):
def setUp(self): def setUp(self):
self.X = [0.0, 0.0, 0.0] self.X = [0.0, 0.0, 0.0]
self.r = [ self.r = [
@ -35,5 +35,5 @@ class TestSequenceFunctions(unittest.TestCase):
if __name__ == '__main__': if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions) suite = unittest.TestLoader().loadTestsFromTestCase(Test)
unittest.TextTestRunner(verbosity=2).run(suite) unittest.TextTestRunner(verbosity=2).run(suite)

4
test/2dcubic.py → test/cubic2d.py Executable file → Normal file
View File

@ -14,7 +14,7 @@ def exact_func(X):
y = X[0] y = X[0]
return 1 + x + y return 1 + x + y
class TestSequenceFunctions(unittest.TestCase): class Test(unittest.TestCase):
def setUp(self): def setUp(self):
self.verts = [ self.verts = [
[ 0.25, 0.40], # 0 [ 0.25, 0.40], # 0
@ -72,5 +72,5 @@ class TestSequenceFunctions(unittest.TestCase):
self.assertTrue(lin_err >= final_err) self.assertTrue(lin_err >= final_err)
if __name__ == '__main__': if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions) suite = unittest.TestLoader().loadTestsFromTestCase(Test)
unittest.TextTestRunner(verbosity=3).run(suite) unittest.TextTestRunner(verbosity=3).run(suite)

4
test/pattern.py Executable file → Normal file
View File

@ -5,7 +5,7 @@ from interp.baker import pattern
class TestSequenceFunctions(unittest.TestCase): class Test(unittest.TestCase):
def setUp(self): def setUp(self):
pass pass
@ -48,5 +48,5 @@ class TestSequenceFunctions(unittest.TestCase):
if __name__ == '__main__': if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions) suite = unittest.TestLoader().loadTestsFromTestCase(Test)
unittest.TextTestRunner(verbosity=3).run(suite) unittest.TextTestRunner(verbosity=3).run(suite)

4
test/qhull.py Executable file → Normal file
View File

@ -2,7 +2,7 @@
import unittest import unittest
class TestSequenceFunctions(unittest.TestCase): class Test(unittest.TestCase):
def setUp(self): def setUp(self):
self.l = [[-1, 1], [-1, 0], [-1, 1], [0, -1], [0, 0], [0, 1], [1, -1], [1, 0], [1, 1]] self.l = [[-1, 1], [-1, 0], [-1, 1], [0, -1], [0, 0], [0, 1], [1, -1], [1, 0], [1, 1]]
@ -23,5 +23,5 @@ class TestSequenceFunctions(unittest.TestCase):
self.assertEqual(dt.indices, answer) self.assertEqual(dt.indices, answer)
if __name__ == '__main__': if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions) suite = unittest.TestLoader().loadTestsFromTestCase(Test)
unittest.TextTestRunner(verbosity=5).run(suite) unittest.TextTestRunner(verbosity=5).run(suite)

4
test/2dquadratic.py → test/quadratic2d.py Executable file → Normal file
View File

@ -14,7 +14,7 @@ def exact_func(X):
y = X[0] y = X[0]
return 1 - x*x + y*y return 1 - x*x + y*y
class TestSequenceFunctions(unittest.TestCase): class Test(unittest.TestCase):
def setUp(self): def setUp(self):
self.points = [ self.points = [
[ 0.25, 0.40], # 0 [ 0.25, 0.40], # 0
@ -77,5 +77,5 @@ class TestSequenceFunctions(unittest.TestCase):
self.assertTrue(lin_err >= final_err) self.assertTrue(lin_err >= final_err)
if __name__ == '__main__': if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions) suite = unittest.TestLoader().loadTestsFromTestCase(Test)
unittest.TextTestRunner(verbosity=3).run(suite) unittest.TextTestRunner(verbosity=3).run(suite)