Beispiel #1
0
    def test_rule_017(self):
        oRule = component.rule_017()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'component')
        self.assertEqual(oRule.identifier, '017')

        dExpected = [{
            'lines': [{
                'number': 38,
                'keyword_column': 12,
                'before_keyword_column': 10
            }, {
                'number': 39,
                'keyword_column': 13,
                'before_keyword_column': 11
            }, {
                'number': 40,
                'keyword_column': 14,
                'before_keyword_column': 12
            }, {
                'number': 41,
                'keyword_column': 13,
                'before_keyword_column': 11
            }],
            'max_keyword_column':
            14,
            'max_before_keyword_column':
            12
        }]
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
    def test_rule_017(self):
        oRule = component.rule_017()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'component')
        self.assertEqual(oRule.identifier, '017')

        dExpected = ['37-42']
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
    def test_rule_017_with_seperate_generic(self):
        oRule = component.rule_017()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'component')
        self.assertEqual(oRule.identifier, '017')

        lExpected = [20, 21, 22, 25, 26, 27]

        oRule.analyze(self.oFile)
        self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
    def test_rule_017_with_combined_generic(self):
        oRule = component.rule_017()
        oRule.separate_generic_port_alignment = False
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'component')
        self.assertEqual(oRule.identifier, '017')

        lExpected = [11, 12, 13, 20, 21, 22, 26, 27]

        oRule.analyze(self.oFile)
        self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
    def test_fix_rule_017_with_seperate_generic(self):
        oRule = component.rule_017()

        oRule.fix(self.oFile)

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

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
 def test_fix_rule_017(self):
     oRule = component.rule_017()
     oRule.fix(oFile)
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, [])