def test_rule_002(self): oRule = subtype.rule_002() self.assertTrue(oRule) self.assertEqual(oRule.name, 'subtype') self.assertEqual(oRule.identifier, '002') dExpected = [7, 11] oRule.analyze(self.oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_002(self): oRule = subtype.rule_002() oRule.fix(self.oFile) oRule.analyze(self.oFile) self.assertEqual(self.oFile.lines[7].line, ' signal read : read_size;') self.assertEqual(self.oFile.lines[11].line, ' constant write_sz : write_size := 1;') self.assertEqual(oRule.violations, [])
def test_rule_002(self): oRule = subtype.rule_002() self.assertTrue(oRule) self.assertEqual(oRule.name, 'subtype') self.assertEqual(oRule.identifier, '002') dExpected = [7, 11] oRule.analyze(self.oFile) self.assertEqual(oRule.violations, dExpected) self.assertEqual(oRule._get_solution(7), 'Inconsistent capitalization of word: READ_SIZE') self.assertEqual(oRule._get_solution(11), 'Inconsistent capitalization of word: WRITE_size')
def test_rule_002(self): oRule = subtype.rule_002() self.assertTrue(oRule) self.assertEqual(oRule.name, 'subtype') self.assertEqual(oRule.identifier, '002') lExpected = [] dViolation = utils.add_violation(7) dViolation['subtype'] = 'READ_SIZE' lExpected.append(dViolation) dViolation = utils.add_violation(11) dViolation['subtype'] = 'WRITE_size' lExpected.append(dViolation) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, lExpected) self.assertEqual(oRule._get_solution(7), 'Inconsistent capitalization of word: READ_SIZE') self.assertEqual(oRule._get_solution(11), 'Inconsistent capitalization of word: WRITE_size')