[2813] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
| 3 | import unittest |
---|
| 4 | from math import sqrt |
---|
| 5 | |
---|
| 6 | from domain import * |
---|
| 7 | from config import epsilon |
---|
| 8 | from Numeric import allclose, array, ones, Float |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | class Test_Domain(unittest.TestCase): |
---|
| 14 | def setUp(self): |
---|
| 15 | pass |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | def tearDown(self): |
---|
| 19 | pass |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | def test_simple(self): |
---|
| 23 | a = [0.0, 0.0] |
---|
| 24 | b = [0.0, 2.0] |
---|
| 25 | c = [2.0,0.0] |
---|
| 26 | d = [0.0, 4.0] |
---|
| 27 | e = [2.0, 2.0] |
---|
| 28 | f = [4.0,0.0] |
---|
| 29 | |
---|
| 30 | points = [a, b, c, d, e, f] |
---|
| 31 | #bac, bce, ecf, dbe, daf, dae |
---|
| 32 | vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]] |
---|
| 33 | |
---|
| 34 | conserved_quantities = ['stage', 'xmomentum', 'ymomentum'] |
---|
| 35 | other_quantities = ['elevation', 'friction'] |
---|
| 36 | |
---|
| 37 | domain = Domain(points, vertices, None, |
---|
| 38 | conserved_quantities, other_quantities) |
---|
| 39 | domain.check_integrity() |
---|
| 40 | |
---|
| 41 | for name in conserved_quantities + other_quantities: |
---|
| 42 | assert domain.quantities.has_key(name) |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | assert domain.get_conserved_quantities(0, edge=1) == 0. |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | #------------------------------------------------------------- |
---|
| 51 | if __name__ == "__main__": |
---|
| 52 | suite = unittest.makeSuite(Test_Domain,'test') |
---|
| 53 | runner = unittest.TextTestRunner() |
---|
| 54 | runner.run(suite) |
---|