/tests/testsuite_default_UnitAlgebra.py
Python | 64 lines | 34 code | 18 blank | 12 comment | 2 complexity | 74f258a0369ced148304c909ab0e614f MD5 | raw file
- # -*- coding: utf-8 -*-
- from sst_unittest import *
- from sst_unittest_support import *
- ################################################################################
- # Code to support a single instance module initialize, must be called setUp method
- module_init = 0
- module_sema = threading.Semaphore()
- def initializeTestModule_SingleInstance(class_inst):
- global module_init
- global module_sema
- module_sema.acquire()
- if module_init != 1:
- # Put your single instance Init Code Here
- module_init = 1
- module_sema.release()
- ################################################################################
- class testcase_UnitAlgebra(SSTTestCase):
- def initializeClass(self, testName):
- super(type(self), self).initializeClass(testName)
- # Put test based setup code here. it is called before testing starts
- # NOTE: This method is called once for every test
- def setUp(self):
- super(type(self), self).setUp()
- initializeTestModule_SingleInstance(self)
- # Put test based setup code here. it is called once before every test
- def tearDown(self):
- # Put test based teardown code here. it is called once after every test
- super(type(self), self).tearDown()
- #####
- def test_UnitAlgebra(self):
- self.unitalgebra_test_template("UnitAlgebra")
- #####
- def unitalgebra_test_template(self, testtype):
- testsuitedir = self.get_testsuite_dir()
- outdir = test_output_get_run_dir()
- sdlfile = "{0}/test_{1}.py".format(testsuitedir, testtype)
- reffile = "{0}/refFiles/test_{1}.out".format(testsuitedir, testtype)
- outfile = "{0}/test_{1}.out".format(outdir, testtype)
- self.run_sst(sdlfile, outfile)
- testing_remove_component_warning_from_file(outfile)
- # Perform the test
- cmp_result = testing_compare_sorted_diff(testtype, outfile, reffile)
- if (cmp_result == False):
- diffdata = testing_get_diff_data("UnitAlgebra")
- log_failure(diffdata)
- self.assertTrue(cmp_result, "Output/Compare file {0} does not match Reference File {1}".format(outfile, reffile))