Ejemplo n.º 1
0
 def test_rule_022(self):
     oRule = if_statement.rule_022()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'if')
     self.assertEqual(oRule.identifier, '022')
     dExpected = [102, 105]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
Ejemplo n.º 2
0
    def test_fix_rule_022(self):
        oRule = if_statement.rule_022()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Ejemplo n.º 3
0
 def test_fix_rule_022(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_022()
     dExpected = []
     oRule.fix(oFile)
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
     self.assertEqual(oFile.lines[102].line, '    else')
     self.assertEqual(oFile.lines[103].line, ' g <= x;')
     self.assertEqual(oFile.lines[103].indentLevel, oFile.lines[102].indentLevel + 1)
Ejemplo n.º 4
0
    def test_rule_022(self):
        oRule = if_statement.rule_022()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'if')
        self.assertEqual(oRule.identifier, '022')

        lExpected = [29, 33]

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