source: anuga_validation/automated_validation_tests/okushiri_tank_validation/validate_okushiri.py @ 6732

Last change on this file since 6732 was 6732, checked in by ole, 15 years ago

Made validate_okushiri independent on the order of tests run.

File size: 2.5 KB
Line 
1"""Automatic verification that the ANUGA code validates against the okushiri
2dataset as expected. See anuga_validation/okushiri_2005 for more details
3"""
4
5import unittest
6import os
7
8
9class Test_Okushiri(unittest.TestCase):
10    def setUp(self):
11       
12        # Remove garbage
13        for file in os.listdir('.'):
14            if file.endswith('.stdout') or\
15                    file.endswith('.sww') or\
16                    file.endswith('.msh'):
17                os.remove(file)
18               
19               
20    def tearDown(self):
21        pass
22
23    def test_that_output_is_as_expected(self):
24        """Test that ANUGA replicates physics of the Okushiri Island
25        wave tank experiment
26        """
27       
28        #print
29        s = 'create_okushiri.py'
30        #print s
31        res = os.system('python %s > create_okushiri.stdout' %s)
32        assert res == 0
33
34        s = 'run_okushiri.py'
35        #print s       
36        res = os.system('python %s > run_okushiri.stdout' %s)       
37        assert res == 0
38       
39       
40        s = 'compare_timeseries_with_measures.py'
41        #print s
42        res = os.system('python %s > compare_timeseries_with_measures.stdout'\
43                        %s)
44        assert res == 0
45
46
47    def test_caching_of_set_quantity(self):
48        """Test that caching of set_quantity works
49        """
50       
51        s = 'create_okushiri.py'
52        res = os.system('python %s > create_okushiri_for_caching.stdout' %s)
53        assert res == 0
54
55
56        s = 'test_caching_of_set_quantity.py'
57        res = os.system('python %s > test_caching_of_set_quantity.stdout' %s)
58        assert res == 0
59
60       
61
62    def manual_test_that_output_is_as_expected(self):
63        from run_okushiri import main
64        from create_okushiri import create_mesh
65
66        # Note, this has not been tested when code is failing.
67        # Next step, use the parrameter elevation_in_mesh
68        # and only run create_okishiri once for speed.
69       
70        res = create_mesh()
71        assert res == None
72       
73        res = main()
74        assert res == None
75       
76        s = 'compare_timeseries_with_measures.py'
77        #print s
78        res = os.system('python %s > compare_timeseries_with_measures.stdout'\
79                        %s)
80        assert res == 0
81       
82
83#-------------------------------------------------------------
84if __name__ == "__main__":
85    suite = unittest.makeSuite(Test_Okushiri, 'test')
86    runner = unittest.TextTestRunner(verbosity=2)
87    runner.run(suite)
Note: See TracBrowser for help on using the repository browser.