def test_rule_016(self): oRule = generic.rule_016() self.assertTrue(oRule) self.assertEqual(oRule.name, 'generic') self.assertEqual(oRule.identifier, '016') lExpected = [13, 13] oRule.analyze(self.oFile) self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
def test_fix_rule_016(self): oRule = generic.rule_016() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_rule_016(self): oRule = generic.rule_016() self.assertTrue(oRule) self.assertEqual(oRule.name, 'generic') self.assertEqual(oRule.identifier, '016') dExpected = [utils.add_violation(21)] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected) oRule.violations = [] dExpected = [utils.add_violation(5)] oRule.analyze(oFileMultiple) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_016(self): oRule = generic.rule_016() oRule.fix(oFileMultiple) oRule.analyze(oFileMultiple) self.assertEqual(oRule.violations, []) self.assertEqual(oFileMultiple.lines[4].line, ' generic (') self.assertEqual(oFileMultiple.lines[5].line, ' G_GENERIC1 : std_logic := \'0\';') self.assertEqual(oFileMultiple.lines[6].line, 'G_GENERIC2 : std_logic := \'1\';') self.assertEqual(oFileMultiple.lines[7].line, 'G_GENERIC3 : std_logic := \'1\';') self.assertEqual(oFileMultiple.lines[8].line, 'G_GENERIC4 : std_logic := \'1\';') self.assertEqual(oFileMultiple.lines[9].line, 'G_GENERIC5 : std_logic := \'1\'') self.assertEqual(oFileMultiple.lines[10].line, ' );')