def test_rule_010(self):
        oRule = port.rule_010()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'port')
        self.assertEqual(oRule.identifier, '010')

        dExpected = [12,13,14,26,27,28,40,41,42,60,61,62,74,75,76]
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
 def test_fix_rule_010(self):
     oRule = port.rule_010()
     oRule.fix(self.oFile)
     self.assertEqual(self.oFile.lines[28].line,
                      '    IO_PORT3(c_index) : inout       NATURAL;')
     self.assertEqual(self.oFile.lines[29].line,
                      '      PORT4(c_index) :in INTEGER;')
     oRule.analyze(self.oFile)
     self.assertEqual(oRule.violations, [])
    def test_fix_rule_010_lower(self):
        oRule = port.rule_010()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_lower, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Exemple #4
0
    def test_rule_010(self):
        oRule = port.rule_010()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'port')
        self.assertEqual(oRule.identifier, '010')

        dExpected = [{
            'line_number': 12,
            'words_to_fix': {'use_4'}
        }, {
            'line_number': 13,
            'words_to_fix': {'port5'}
        }, {
            'line_number': 14,
            'words_to_fix': {'port6'}
        }, {
            'line_number': 26,
            'words_to_fix': {'i_port1'}
        }, {
            'line_number': 27,
            'words_to_fix': {'o_port2'}
        }, {
            'line_number': 28,
            'words_to_fix': {'io_port3'}
        }, {
            'line_number': 40,
            'words_to_fix': {'i_port1'}
        }, {
            'line_number': 41,
            'words_to_fix': {'o_port2'}
        }, {
            'line_number': 42,
            'words_to_fix': {'io_port3'}
        }, {
            'line_number': 60,
            'words_to_fix': {'port4'}
        }, {
            'line_number': 61,
            'words_to_fix': {'port5'}
        }, {
            'line_number': 62,
            'words_to_fix': {'port6'}
        }, {
            'line_number': 74,
            'words_to_fix': {'port4'}
        }, {
            'line_number': 75,
            'words_to_fix': {'port5'}
        }, {
            'line_number': 76,
            'words_to_fix': {'port6'}
        }]
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
    def test_rule_010_upper(self):
        oRule = port.rule_010()
        oRule.case = 'upper'
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'port')
        self.assertEqual(oRule.identifier, '010')

        lExpected = [14, 15, 16, 17]
        oRule.analyze(self.oFile)
        self.assertEqual(
            utils.extract_violation_lines_from_violation_object(
                oRule.violations), lExpected)
    def test_rule_010_lower(self):
        oRule = port.rule_010()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'port')
        self.assertEqual(oRule.identifier, '010')

        lExpected = [4, 5, 6, 7]

        oRule.analyze(self.oFile)
        self.assertEqual(
            utils.extract_violation_lines_from_violation_object(
                oRule.violations), lExpected)
    def test_rule_010(self):
        oRule = port.rule_010()
        oRule.case = 'upper'
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'port')
        self.assertEqual(oRule.identifier, '010')

        lExpected = []
        dViolation = utils.add_violation(12)
        dViolation['words_to_fix'] = {'use_4'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(13)
        dViolation['words_to_fix'] = {'port5'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(14)
        dViolation['words_to_fix'] = {'port6'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(26)
        dViolation['words_to_fix'] = {'i_port1'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(27)
        dViolation['words_to_fix'] = {'o_port2'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(28)
        dViolation['words_to_fix'] = {'io_port3'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(40)
        dViolation['words_to_fix'] = {'i_port1'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(41)
        dViolation['words_to_fix'] = {'o_port2'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(42)
        dViolation['words_to_fix'] = {'io_port3'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(60)
        dViolation['words_to_fix'] = {'port4'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(61)
        dViolation['words_to_fix'] = {'port5'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(62)
        dViolation['words_to_fix'] = {'port6'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(74)
        dViolation['words_to_fix'] = {'port4'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(75)
        dViolation['words_to_fix'] = {'port5'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(76)
        dViolation['words_to_fix'] = {'port6'}
        lExpected.append(dViolation)

        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, lExpected)