Exemplo n.º 1
0
    def test_fix_rule_029(self):
        oRule = instantiation.rule_029()
        lFileComment = utils.read_vhdlfile(
            os.path.join(os.path.dirname(__file__),
                         'instantiation_comment_test_input.vhd'))
        oFileComment = vhdlFile.vhdlFile(lFileComment)
        oRule.fix(oFileComment)
        oRule.analyze(oFileComment)
        self.assertEqual(oRule.violations, [])
        self.assertEqual(
            oFileComment.lines[7].line,
            '      generic_1 : std_logic := \'0\'; -- This should be removed')
        self.assertEqual(
            oFileComment.lines[12].line,
            '      port_2 : in    std_logic;-- This should be removed')
        self.assertEqual(
            oFileComment.lines[14].line,
            '      port_4 : out   std_logic; -- This should be removed')

        self.assertEqual(
            oFileComment.lines[24].line,
            '      generic_1 => \'0\', -- This should be removed')
        self.assertEqual(oFileComment.lines[29].line,
                         '      port_2 => \'1\', -- This should be removed')
        self.assertEqual(oFileComment.lines[31].line,
                         '      port_4 => \'1\'  -- This should be removed')
Exemplo n.º 2
0
    def test_rule_029(self):
        oRule = instantiation.rule_029()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'instantiation')
        self.assertEqual(oRule.identifier, '029')

        lExpected = [23, 24, 27, 28, 29]

        oRule.analyze(self.oFile)
        self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
Exemplo n.º 3
0
 def test_rule_029(self):
     oRule = instantiation.rule_029()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'instantiation')
     self.assertEqual(oRule.identifier, '029')
     lFileComment = utils.read_vhdlfile(os.path.join(os.path.dirname(__file__),'instantiation_comment_test_input.vhd'))
     oFileComment = vhdlFile.vhdlFile(lFileComment)
     dExpected = ['22-32']
     oRule.analyze(oFileComment)
     self.assertEqual(oRule.violations, dExpected)
Exemplo n.º 4
0
    def test_fix_rule_029(self):
        oRule = instantiation.rule_029()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])