Changeset 8786


Ignore:
Timestamp:
Mar 28, 2013, 6:14:52 PM (12 years ago)
Author:
steve
Message:

Adding in some automated validation tests

Location:
trunk/anuga_core
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga_validation_tests/Case_studies/Okushiri/run_okushiri.py

    r8694 r8786  
    4949    print 'set stage'
    5050    if elevation_in_mesh is False:
    51         print 'start '
    5251        domain.set_quantity('elevation',
    5352                            filename=project.bathymetry_filename,
     
    5554                            verbose=True,
    5655                            use_cache=False)
    57         print 'end'
    5856
    5957
  • trunk/anuga_core/source/anuga_validation_tests/Case_studies/Okushiri/validate_okushiri.py

    r8676 r8786  
    1 """Automatic verification that the ANUGA code validates against the okushiri
    2 dataset as expected. See anuga_validation/okushiri_2005 for more details
     1"""Automatic verification of ANUGA flows.
     2See functions exercised by this wrapper for more details
    33"""
    44
    55import unittest
    66import os
     7import numpy
     8import anuga
    79
     10indent = anuga.indent
    811
    9 class Test_Okushiri(unittest.TestCase):
     12verbose = True
     13
     14class Test_results(unittest.TestCase):
    1015    def setUp(self):
    11        
    12         # Remove garbage
    13         for file in os.listdir('.'):
     16        for file in os.listdir('.'):   
    1417            if file.endswith('.stdout') or\
    1518                    file.endswith('.sww') or\
    16                     file.endswith('.msh'):
     19                    file.endswith('.msh') or\
     20                    file.endswith('.png'):
    1721                os.remove(file)
    1822               
    19                
     23       
    2024    def tearDown(self):
    2125        pass
    2226
    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
     27    def test_simulation(self):
     28   
     29
     30        if verbose:
     31            print
     32            print indent+'Running create mesh script'
     33           
    2934        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)
     35        res = os.system('python %s > validate_create.stdout' %s)
     36        # Test that script runs ok
    4437        assert res == 0
    4538
    4639
    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)
     40        if verbose:
     41            print indent+'Running simulation script'
     42
     43        s = 'run_okushiri.py'
     44        res = os.system('python %s > validate_run.stdout' %s)
     45        # Test that script runs ok
    5346        assert res == 0
    5447
    5548
    56         s = 'test_caching_of_set_quantity.py'
    57         res = os.system('python %s > test_caching_of_set_quantity.stdout' %s)
     49
     50        if verbose:
     51            print indent+'Running test script'
     52
     53        s = 'compare_timeseries_with_measures.py'
     54        res = os.system('python %s > validate_test.stdout' %s)
     55        # Test that script runs ok
    5856        assert res == 0
    5957
    6058       
    6159
    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        
    8260
    8361#-------------------------------------------------------------
    84 if __name__ == "__main__":
    85     suite = unittest.makeSuite(Test_Okushiri, 'test')
     62if __name__ == '__main__':
     63    suite = unittest.makeSuite(Test_results, 'test')
    8664    runner = unittest.TextTestRunner(verbosity=2)
    8765    runner.run(suite)
Note: See TracChangeset for help on using the changeset viewer.