Пример #1
0
 def test_rule_024(self):
     oRule = if_statement.rule_024()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'if')
     self.assertEqual(oRule.identifier, '024')
     dExpected = [98, 99, 105, 109]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
Пример #2
0
    def test_rule_024(self):
        oRule = if_statement.rule_024()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'if')
        self.assertEqual(oRule.identifier, '024')

        lExpected = [25, 26, 28, 29]

        oRule.analyze(self.oFile)
        self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
Пример #3
0
    def test_fix_rule_024(self):
        oRule = if_statement.rule_024()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Пример #4
0
 def test_fix_rule_024(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_024()
     dExpected = []
     oRule.fix(oFile)
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
     self.assertEqual(oFile.lines[107].line, '    if (a = 2) then')
     self.assertEqual(oFile.lines[108].line, ' b <= \'1\'; else b <= \'0\'; end if;')
     self.assertEqual(oFile.lines[108].indentLevel, oFile.lines[107].indentLevel + 1)
     self.assertFalse(oFile.lines[107].isEndIfKeyword)
     self.assertFalse(oFile.lines[107].isElseKeyword)