def test_rule_011(self): oRule = signal.rule_011() self.assertTrue(oRule) self.assertEqual(oRule.name, 'signal') self.assertEqual(oRule.identifier, '011') dExpected = [12, 16, 23] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_011(self): oRule = signal.rule_011() lExpected = [] oRule.fix(self.oFile) oRule.analyze(self.oFile) self.assertEqual(self.oFile.lines[12].line, ' signal SIg : std_logic_vector(31 downto 0);') self.assertEqual(self.oFile.lines[16].line, ' signal sig : std_logic_vector (31 downto 0) := (others => \'0\');') self.assertEqual(self.oFile.lines[20].line, ' signal b_siG100, b_Sig2 :std_logic_vector (31 downto 0);') self.assertEqual(self.oFile.lines[23].line, ' signal w_sig1 : t_user_defined_type;') self.assertEqual(oRule.violations, lExpected)
def test_rule_011_upper(self): oRule = signal.rule_011() oRule.case = 'upper' self.assertTrue(oRule) self.assertEqual(oRule.name, 'signal') self.assertEqual(oRule.identifier, '011') lExpected = [4, 5] oRule.analyze(self.oFile) self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)
def test_fix_rule_011_lower(self): oRule = signal.rule_011() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected_lower, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_rule_011(self): oRule = signal.rule_011() self.assertTrue(oRule) self.assertEqual(oRule.name, 'signal') self.assertEqual(oRule.identifier, '011') lExpected = [{ 'line_number': 12, 'words_to_fix': {'STD_LOGIC_VECTOR'} }, { 'line_number': 16, 'words_to_fix': {'STD_LOGIC_VECTOR'} }, { 'line_number': 23, 'words_to_fix': {'t_User_Defined_Type'} }] oRule.analyze(oFile) self.assertEqual(oRule.violations, lExpected)
def test_rule_011(self): oRule = signal.rule_011() self.assertTrue(oRule) self.assertEqual(oRule.name, 'signal') self.assertEqual(oRule.identifier, '011') lExpected = [] dViolation = utils.add_violation(12) dViolation['words_to_fix'] = {'STD_LOGIC_VECTOR'} lExpected.append(dViolation) dViolation = utils.add_violation(16) dViolation['words_to_fix'] = {'STD_LOGIC_VECTOR'} lExpected.append(dViolation) dViolation = utils.add_violation(23) dViolation['words_to_fix'] = {'t_User_Defined_Type'} lExpected.append(dViolation) oRule.analyze(oFile) self.assertEqual(oRule.violations, lExpected)