source: branches/numpy/anuga/shallow_water/test_eq.py @ 6441

Last change on this file since 6441 was 6441, checked in by rwilson, 15 years ago

After changes to get_absolute, ensure_numeric, etc.

File size: 1.8 KB
Line 
1import unittest
2import numpy as num
3from eqf import earthquake_tsunami, Okada_func
4
5
6class Test_eq(unittest.TestCase):
7    def setUp(self):
8        pass
9
10    def tearDown(self):
11        pass
12
13
14    def test_Okada_func(self):
15        x0 = 38000.0
16        y0 = 12500.0
17        length = 25.0
18        width = 5.0
19        strike = 0.0
20        depth = 3500.
21        slip = 10.0
22        dip = 15.0
23        rake = 90.0
24        test = -2205.904774487
25
26        #print 'depth', depth
27        z = Okada_func(length=length, width=width, dip=dip, \
28                       x0=x0, y0=y0, strike=strike, depth=depth, \
29                       slip=slip, rake=rake, test=test)
30
31        assert num.allclose(z.length, length)
32        assert num.allclose(z.width, width)
33        assert num.allclose(z.x0, x0)
34        assert num.allclose(z.y0, y0)
35        assert num.allclose(z.strike, strike)
36        assert num.allclose(z.depth, depth)
37        assert num.allclose(z.slip, slip)
38        assert num.allclose(z.dip, dip)
39        assert num.allclose(z.rake, rake)
40
41        #print 'in test', z.test
42        assert num.allclose(z.test, -2205.904774487)
43       
44        #print 'hello finished okada'
45
46    def test_earthquake_tsunami(self):
47
48        x0 = 0.0
49        y0 = 0.0
50        length = 25.0
51        width = 5.0
52        strike = 0.0
53        depth = 3500.
54        slip = 10.0
55        dip = 15.0
56       
57        eq = earthquake_tsunami(length=length, width = width, depth=depth, \
58                                strike = strike, dip = dip, slip = slip, \
59                                x0 = x0, y0 = y0)
60
61#-------------------------------------------------------------
62
63if __name__ == "__main__":
64    suite = unittest.makeSuite(Test_eq,'test_Okada_func')
65    runner = unittest.TextTestRunner()
66    runner.run(suite)
67
Note: See TracBrowser for help on using the repository browser.