Commit 24bfe5e9 authored by MischaD's avatar MischaD
Browse files

TestCases for Supremum + Unwanted Subshell + InitSchemes

parent 21bc458a
......@@ -71,6 +71,43 @@ class TestReducibleShell(unittest.TestCase):
self.assertAlmostEqual(sp.N(interval.sup), 0.9054850, places=6)
class TestSupremum(unittest.TestCase):
def setUp(self):
self.seed = 20
self.lattice = Lattice(dimension=2, order=4, shell_list=[1, 2, 4], seed=self.seed, boundary="sup")
def testOutput(self):
weights = self.lattice.calculate_weights()
self.assertEqual(len(weights), 4)
self.assertEqual(self.lattice.velocities, ["00", "10", "11", "20"])
self.assertEqual(self.lattice.shell_from_type("10").weight, 0)
class TestUnwantedSubshells(unittest.TestCase):
def setUp(self):
self.seed = 20
self.lattice = Lattice(dimension=3, order=6, shell_list=[1,2,3,9,16,27], boundary="sup", unwanted_subshells=["221", "511"])
def testOutput(self):
weights = self.lattice.calculate_weights()
self.assertEqual(len(weights), 7)
interval = self.lattice._interval
self.assertAlmostEqual(sp.N(interval.inf), 0.3500280, places=6)
self.assertAlmostEqual(sp.N(interval.sup), 0.3675445, places=6)
class TestInitSchemes(unittest.TestCase):
def setUp(self):
self.seed = 20
self.lattice = Lattice(dimension=2, order=4, shell_list=[1, 2, 4], seed=self.seed)
self.lattice_from_order = Lattice.from_order(dimension=2, order=4)
self.lattice_from_name = Lattice.from_name("D2Q9")
def test_lattice_equivalent(self):
self.assertTrue(self.lattice.weights == self.lattice_from_name.weights)
self.assertTrue(self.lattice.weights == self.lattice_from_order.weights)
if __name__ == '__main__':
logger.disabled = True
unittest.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment