예제 #1
0
    def test_fix_rule_004(self):
        oRule = constant.rule_004()
        dExpected = []
        oRule.fix(self.oFile)
        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, dExpected)
        self.assertEqual(self.oFile.lines[5].line,  '  constant c_const : std_logic := \'1\';')
        self.assertEqual(self.oFile.lines[6].line,  '  constant const : std_logic := \'0\';')
        self.assertEqual(self.oFile.lines[7].line,  '  COnstant  c_const : std_logic := \'1\';')
        self.assertEqual(self.oFile.lines[8].line,  'Constant c_const :  std_logic := \'0\';')
        self.assertEqual(self.oFile.lines[9].line,  'constant const  :  STD_LOGIC:=\'0\';')
        self.assertEqual(self.oFile.lines[10].line, '   constant c_const: std_logic')

        oRule = constant.rule_004()
        oRule.case = 'upper'
        dExpected = []
        oRule.fix(self.oFile)
        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, dExpected)
        self.assertEqual(self.oFile.lines[5].line,  '  constant C_CONST : std_logic := \'1\';')
        self.assertEqual(self.oFile.lines[6].line,  '  constant CONST : std_logic := \'0\';')
        self.assertEqual(self.oFile.lines[7].line,  '  COnstant  C_CONST : std_logic := \'1\';')
        self.assertEqual(self.oFile.lines[8].line,  'Constant C_CONST :  std_logic := \'0\';')
        self.assertEqual(self.oFile.lines[9].line,  'constant CONST  :  STD_LOGIC:=\'0\';')
        self.assertEqual(self.oFile.lines[10].line, '   constant C_CONST: std_logic')
예제 #2
0
 def test_rule_004(self):
     oRule = constant.rule_004()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'constant')
     self.assertEqual(oRule.identifier, '004')
     lExpected = [{'line_number': 8, 'words_to_fix': {'c_coNST'}}]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, lExpected)
 def test_rule_004(self):
     oRule = constant.rule_004()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'constant')
     self.assertEqual(oRule.identifier, '004')
     lExpected = [8]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, lExpected)
예제 #4
0
    def test_rule_004_upper(self):
        oRule = constant.rule_004()
        oRule.case = 'upper'
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'constant')
        self.assertEqual(oRule.identifier, '004')

        lExpected = [4, 8]
        oRule.analyze(self.oFile)
        self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)
예제 #5
0
    def test_fix_rule_004_lower(self):
        oRule = constant.rule_004()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_lower, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
예제 #6
0
 def test_fix_rule_004(self):
     oRule = constant.rule_004()
     dExpected = []
     oRule.fix(oFile)
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)