Exemplo n.º 1
0
 def test_rule_029(self):
     oRule = if_statement.rule_029()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'if')
     self.assertEqual(oRule.identifier, '029')
     dExpected = [{'lines': [{'number': 14}], 'words_to_fix': {'THEN'}}]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
Exemplo n.º 2
0
 def test_rule_029(self):
     oRule = if_statement.rule_029()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'if')
     self.assertEqual(oRule.identifier, '029')
     dExpected = [14]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
 def test_fix_rule_029(self):
     oRule = if_statement.rule_029()
     dExpected = []
     oRule.fix(oFile)
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
     self.assertEqual(oFile.lines[14].line,
                      '        g = 34 or x = 3000 ) then')
Exemplo n.º 4
0
 def test_fix_rule_029(self):
     lFile = utils.read_vhdlfile(os.path.join(os.path.dirname(__file__),'..','if_statement','if_test_input.vhd'))
     oFile = vhdlFile.vhdlFile(lFile)
     oRule = if_statement.rule_029()
     self.assertEqual(oFile.lines[14].line, '       g = 34 or x = 3000 THEN')
     dExpected = []
     oRule.fix(oFile)
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
     self.assertEqual(oFile.lines[14].line, '       g = 34 or x = 3000 then')
Exemplo n.º 5
0
    def test_fix_rule_029_lower(self):
        oRule = if_statement.rule_029()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_lower, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Exemplo n.º 6
0
    def test_rule_029_upper(self):
        oRule = if_statement.rule_029()
        oRule.case = 'upper'
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'if')
        self.assertEqual(oRule.identifier, '029')

        lExpected = [10, 12, 15, 17]
        oRule.analyze(self.oFile)
        self.assertEqual(
            utils.extract_violation_lines_from_violation_object(
                oRule.violations), lExpected)
Exemplo n.º 7
0
    def test_rule_029_lower(self):
        oRule = if_statement.rule_029()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'if')
        self.assertEqual(oRule.identifier, '029')

        lExpected = [25, 27, 30, 32]

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