def test_rule_018(self):
        oRule = entity.rule_018()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'entity')
        self.assertEqual(oRule.identifier, '018')

        dExpected = ['19-33']
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
 def test_fix_rule_018(self):
     oRule = entity.rule_018()
     oRule.fix(self.oFile)
     oRule.analyze(self.oFile)
     self.assertEqual(oRule.violations, [])
     self.assertEqual(self.oFile.lines[21].line,
                      '       G_GENERIC1 : std_logic :=\'0\';-- Comment')
     self.assertEqual(
         self.oFile.lines[22].line,
         '    G_generic2 : std_logic    := \'1\'             -- Comment')
    def test_rule_018_with_seperate_generic(self):
        oRule = entity.rule_018()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'entity')
        self.assertEqual(oRule.identifier, '018')

        lExpected = [11, 12, 19, 21, 24, 25, 26]

        oRule.analyze(self.oFile)
        self.assertEqual(
            lExpected,
            utils.extract_violation_lines_from_violation_object(
                oRule.violations))
Example #4
0
    def test_rule_018(self):
        oRule = entity.rule_018()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'entity')
        self.assertEqual(oRule.identifier, '018')

        dExpected = [{'lines': [{'number': 21, 'keyword_column': 30, 'before_keyword_column': 28},
                                {'number': 22, 'keyword_column': 27, 'before_keyword_column': 25}],
                      'max_keyword_column': 30, 'max_before_keyword_column': 28},
                     {'lines': [{'number': 52, 'keyword_column': 29, 'before_keyword_column': 27},
                                {'number': 53, 'keyword_column': 25, 'before_keyword_column': 23}],
                      'max_keyword_column': 29, 'max_before_keyword_column': 27}]
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
    def test_fix_rule_018_with_seperate_generic(self):
        oRule = entity.rule_018()

        oRule.fix(self.oFile)

        lExpected = []
        lExpected.append('')
        utils.read_file(
            os.path.join(sTestDir,
                         'rule_018_test_input.fixed_seperate_generic.vhd'),
            lExpected)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected, lActual)

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