def test_rule_012(self): oRule = signal.rule_012() self.assertTrue(oRule) self.assertEqual(oRule.name, 'signal') self.assertEqual(oRule.identifier, '012') lExpected = [] dViolation = utils.add_violation(5) dViolation['comma'] = 16 dViolation['max'] = 23 dViolation['signal'] = 18 lExpected.append(dViolation) dViolation = utils.add_violation(6) dViolation['comma'] = 17 dViolation['max'] = 23 dViolation['signal'] = 19 lExpected.append(dViolation) dViolation = utils.add_violation(7) dViolation['comma'] = 18 dViolation['max'] = 23 dViolation['signal'] = 20 lExpected.append(dViolation) dViolation = utils.add_violation(8) dViolation['comma'] = 19 dViolation['max'] = 23 dViolation['signal'] = 21 lExpected.append(dViolation) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, lExpected)
def test_rule_012(self): oRule = signal.rule_012() self.assertTrue(oRule) self.assertEqual(oRule.name, 'signal') self.assertEqual(oRule.identifier, '012') dExpected = [5,6,7,8] oRule.analyze(self.oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_012(self): oRule = signal.rule_012() dExpected = [] oRule.fix(self.oFile) oRule.analyze(self.oFile) self.assertEqual(self.oFile.lines[5].line,' signal e_sig1, d_sig2 : std_logic;') self.assertEqual(self.oFile.lines[6].line,' signal a_sig10, c_sig2 : std_logic;') self.assertEqual(self.oFile.lines[7].line,' signal b_sig100, b_sig2 : std_logic_vector (31 downto 0);') self.assertEqual(self.oFile.lines[8].line,' signal c_sig1000, a_sig2 : std_logic;') self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_012(self): oRule = signal.rule_012() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_rule_012(self): oRule = signal.rule_012() self.assertTrue(oRule) self.assertEqual(oRule.name, 'signal') self.assertEqual(oRule.identifier, '012') dExpected = utils.add_violation_list([5,6,7,8]) dExpected = [{'comma': 16, 'lineNumber': 5, 'max': 23, 'signal': 18}, {'comma': 17, 'lineNumber': 6, 'max': 23, 'signal': 19}, {'comma': 18, 'lineNumber': 7, 'max': 23, 'signal': 20}, {'comma': 19, 'lineNumber': 8, 'max': 23, 'signal': 21}] oRule.analyze(self.oFile) self.assertEqual(oRule.violations, dExpected)
def test_rule_012(self): oRule = signal.rule_012() self.assertTrue(oRule) self.assertEqual(oRule.name, 'signal') self.assertEqual(oRule.identifier, '012') lExpected = [4, 5, 10] oRule.analyze(self.oFile) self.assertEqual( lExpected, utils.extract_violation_lines_from_violation_object( oRule.violations))