renamed test files
--HG-- rename : test/cubic.test.py => test/2dcubic.py rename : test/quad.test.py => test/2dquadratic.py rename : test/baker.test.py => test/baker2d.py rename : test/baker.order.test.py => test/baker2dorder.py rename : test/baker3D.test.py => test/baker3d.py rename : test/qhull.test.py => test/qhull.py
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import unittest
|
||||
from interp.baker import get_phis, qlinear
|
||||
from interp.grid import grid
|
||||
|
||||
import numpy as np
|
||||
import scipy.spatial
|
||||
|
||||
class TestSequenceFunctions(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.X = [0.0, 0.0, 0.0]
|
||||
self.r = [
|
||||
[0.0, 0.0, 1.0],
|
||||
[0.94280904333606508, 0.0, -0.3333333283722672],
|
||||
[-0.47140452166803232, 0.81649658244673617, -0.3333333283722672],
|
||||
[-0.47140452166803298, -0.81649658244673584, -0.3333333283722672],
|
||||
]
|
||||
self.q = [0.0, 0.0, 0.0, 4]
|
||||
|
||||
|
||||
def testGetPhis(self):
|
||||
result = get_phis(self.X, self.r)
|
||||
right_answer = [0.25, 0.25, 0.25, 0.25]
|
||||
|
||||
for a,b in zip(result, right_answer):
|
||||
self.assertAlmostEqual(a,b)
|
||||
|
||||
|
||||
def testQlinear(self):
|
||||
phi, result = qlinear(self.X, grid(self.r, self.q))
|
||||
result = result
|
||||
right_answer = 1.0
|
||||
self.assertAlmostEqual(result, right_answer)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions)
|
||||
unittest.TextTestRunner(verbosity=2).run(suite)
|
||||
Reference in New Issue
Block a user