Ejemplo n.º 1
0
 def test_rule_021(self):
     oRule = if_statement.rule_021()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'if')
     self.assertEqual(oRule.identifier, '021')
     dExpected = [105, 109]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
Ejemplo n.º 2
0
    def test_rule_021(self):
        oRule = if_statement.rule_021()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'if')
        self.assertEqual(oRule.identifier, '021')

        lExpected = [28, 32]

        oRule.analyze(self.oFile)
        self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
Ejemplo n.º 3
0
    def test_fix_rule_021(self):
        oRule = if_statement.rule_021()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Ejemplo n.º 4
0
 def test_fix_rule_021(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_021()
     dExpected = []
     oRule.fix(oFile)
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
     self.assertEqual(oFile.lines[105].line, '    if (a = 2) then b <= \'1\'; ')
     self.assertEqual(oFile.lines[106].line, 'else b <= \'0\'; end if;')
     self.assertEqual(oFile.lines[106].indentLevel, oFile.lines[105].indentLevel)