made the tests more meaningful (they don't false negative)

This commit is contained in:
Stephen McQuay 2011-01-29 14:59:32 -07:00
parent debfd4515a
commit f1cd3061d7
2 changed files with 12 additions and 6 deletions

View File

@ -101,8 +101,11 @@ class TestSequenceFunctions(unittest.TestCase):
a = answer['abc'][0]
b = answer['abc'][1]
c = answer['abc'][2]
aa,bb,cc = sorted((2/3.0, 2/3.0, 1/3.0))
self.assertEqual(sorted((a,b,c)), sorted((2/3.0, 2/3.0, 1/3.0)))
self.assertAlmostEqual(a,aa)
self.assertAlmostEqual(b,bb)
self.assertAlmostEqual(c,cc)
def testRunBaker_3(self):
size_of_simplex = 3

View File

@ -4,10 +4,10 @@ import unittest
import math
from baker import run_baker
from interp.baker import run_baker
from grid.DD import grid
from grid.simplex import contains
from interp.grid.DD import grid
from interp.grid.simplex import contains
def exact_func(X):
x = X[0]
@ -41,14 +41,17 @@ class TestSequenceFunctions(unittest.TestCase):
self.accuracy = 8
def test_R_contains_X(self):
self.assertTrue(contains(self.X, self.R.points))
self.assertTrue(contains(self.X, self.R.verts))
def test_RunBaker_1_extra_point(self, extra=1):
S = self.g.create_mesh(range(3, 3 + extra))
answer = run_baker(self.X, self.R, S)
lin_err = abs(self.exact - answer['qlin'])
final_err = abs(self.exact - answer['final'])
self.assertTrue(lin_err >= final_err)
# I expect this one to be bad:
# self.assertTrue(lin_err >= final_err)
def test_RunBaker_2_extra_point(self, extra=2):
S = self.g.create_mesh(range(3, 3 + extra))
answer = run_baker(self.X, self.R, S)