import os import unittest from vsg.rules import context from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError = vhdlFile.utils.read_vhdlfile( os.path.join(sTestDir, 'rule_017_test_input.vhd')) lExpected = [] lExpected.append('') utils.read_file(os.path.join(sTestDir, 'rule_017_test_input.fixed.vhd'), lExpected) class test_context_rule(unittest.TestCase): def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) def test_rule_017(self): oRule = context.rule_017() self.assertTrue(oRule) self.assertEqual(oRule.name, 'context') self.assertEqual(oRule.identifier, '017') lExpected = [8, 12, 17] oRule.analyze(self.oFile)
import os import unittest from vsg.rules import block from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError = vhdlFile.utils.read_vhdlfile( os.path.join(sTestDir, 'rule_204_test_input.vhd')) lExpected = [] lExpected.append('') utils.read_file(os.path.join(sTestDir, 'rule_204_test_input.fixed.vhd'), lExpected, False) class test_block_rule(unittest.TestCase): def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) def test_rule_204(self): oRule = block.rule_204() self.assertTrue(oRule) self.assertEqual(oRule.name, 'block') self.assertEqual(oRule.identifier, '204') lExpected = [15]
import os import unittest from vsg.rules import procedure from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError = vhdlFile.utils.read_vhdlfile( os.path.join(sTestDir, 'rule_503_test_input.vhd')) lExpected_lower = [] lExpected_lower.append('') utils.read_file(os.path.join(sTestDir, 'rule_503_test_input.fixed_lower.vhd'), lExpected_lower) lExpected_upper = [] lExpected_upper.append('') utils.read_file(os.path.join(sTestDir, 'rule_503_test_input.fixed_upper.vhd'), lExpected_upper) class test_procedure_rule(unittest.TestCase): def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) def test_rule_503_lower(self): oRule = procedure.rule_503() self.assertTrue(oRule)
import os import unittest from vsg.rules import architecture from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError = vhdlFile.utils.read_vhdlfile( os.path.join(sTestDir, 'rule_015_test_input.vhd')) lExpected_require_blank = [] lExpected_require_blank.append('') utils.read_file( os.path.join(sTestDir, 'rule_015_test_input.fixed_require_blank.vhd'), lExpected_require_blank) lExpected_no_blank = [] lExpected_no_blank.append('') utils.read_file( os.path.join(sTestDir, 'rule_015_test_input.fixed_no_blank.vhd'), lExpected_no_blank) class test_architecture_rule(unittest.TestCase): def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) def test_rule_015_w_require_blank(self):
import os import unittest from vsg.rules import package_body from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError = vhdlFile.utils.read_vhdlfile( os.path.join(sTestDir, 'rule_003_test_input.vhd')) lExpected_add = [] lExpected_add.append('') utils.read_file(os.path.join(sTestDir, 'rule_003_test_input.fixed_add.vhd'), lExpected_add) lExpected_remove = [] lExpected_remove.append('') utils.read_file(os.path.join(sTestDir, 'rule_003_test_input.fixed_remove.vhd'), lExpected_remove) class test_package_body_rule(unittest.TestCase): def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) def test_rule_003_add(self): oRule = package_body.rule_003() self.assertTrue(oRule)
import os import unittest from vsg.rules import entity from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError = vhdlFile.utils.read_vhdlfile( os.path.join(sTestDir, 'rule_003_test_input.vhd')) lExpected_require_blank = [] lExpected_require_blank.append('') utils.read_file( os.path.join(sTestDir, 'rule_003_test_input.fixed_require_blank.vhd'), lExpected_require_blank) lExpected_no_code = [] lExpected_no_code.append('') utils.read_file( os.path.join(sTestDir, 'rule_003_test_input.fixed_no_code.vhd'), lExpected_no_code) lExpected_allow_comment = [] lExpected_allow_comment.append('') utils.read_file( os.path.join(sTestDir, 'rule_003_test_input.fixed_allow_comment.vhd'), lExpected_allow_comment) lExpected_require_comment = []
import os import unittest from vsg.rules import library from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError = vhdlFile.utils.read_vhdlfile( os.path.join(sTestDir, 'rule_003_test_input.vhd')) lExpected_default = [] lExpected_default.append('') utils.read_file( os.path.join(sTestDir, 'rule_003_test_input.fixed_default.vhd'), lExpected_default) lExpected_allow_library_clause = [] lExpected_allow_library_clause.append('') utils.read_file( os.path.join(sTestDir, 'rule_003_test_input.fixed_allow_library_clause.vhd'), lExpected_allow_library_clause) class test_library_rule(unittest.TestCase): def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError)
import os import unittest from vsg.rules import if_statement from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError = vhdlFile.utils.read_vhdlfile( os.path.join(sTestDir, 'rule_002_test_input.vhd')) lExpected_parenthesis_insert = [] lExpected_parenthesis_insert.append('') utils.read_file( os.path.join(sTestDir, 'rule_002_test_input.fixed_parenthesis_insert.vhd'), lExpected_parenthesis_insert) lExpected_parenthesis_remove = [] lExpected_parenthesis_remove.append('') utils.read_file( os.path.join(sTestDir, 'rule_002_test_input.fixed_parenthesis_remove.vhd'), lExpected_parenthesis_remove) class test_if_statement_rule(unittest.TestCase): def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) def test_rule_002_parenthesis_insert(self):