Exemple #1
0
    def test_rule_031(self):
        oRule = process.rule_031()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'process')
        self.assertEqual(oRule.identifier, '031')

        lExpected = [11, 12, 13, 30, 32, 33, 35, 62, 85, 100, 101, 115]

        oRule.analyze(self.oFile)
        self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
Exemple #2
0
    def test_fix_rule_031(self):
        oRule = process.rule_031()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Exemple #3
0
    def test_fix_rule_031(self):
        oRule = process.rule_031()
        dExpected = []
        oRule.fix(self.oFile)
        #        utils.debug_lines(self.oFile, 22, 11)
        self.assertEqual(self.oFile.lines[4].line,
                         '  variable var1 : boolean := False;')
        self.assertEqual(self.oFile.lines[5].line,
                         '  constant con1 : integer;')
        self.assertEqual(self.oFile.lines[6].line,
                         '  signal sig1 : std_logic; -- Sig')
        self.assertEqual(
            self.oFile.lines[7].line,
            '  file file1 : load_file_file open read_mode is load_file_name;')
        self.assertEqual(self.oFile.lines[24].line,
                         '    variable var1   : boolean;')
        self.assertEqual(self.oFile.lines[25].line,
                         '    constant con1   : integer := 1;')
        self.assertEqual(
            self.oFile.lines[26].line,
            '    file     file1  : load_file_file open read_mode is load_file_name; -- 1'
        )
        self.assertEqual(self.oFile.lines[27].line, '')
        self.assertEqual(self.oFile.lines[28].line,
                         '    variable var12  : boolean;')
        self.assertEqual(self.oFile.lines[29].line,
                         '    constant con12  : integer;')
        self.assertEqual(
            self.oFile.lines[30].line,
            '    file     file12 : load_file_file open read_mode is load_file_name; -- 2'
        )

        self.assertEqual(self.oFile.lines[38].line,
                         '    variable var1   : boolean;')
        self.assertEqual(self.oFile.lines[39].line,
                         '    constant con1   : integer;')
        self.assertEqual(
            self.oFile.lines[40].line,
            '    file     file1  : load_file_file open read_mode is load_file_name; -- 3'
        )
        self.assertEqual(self.oFile.lines[41].line, '')
        self.assertEqual(self.oFile.lines[42].line,
                         '    variable var12  : boolean;')
        self.assertEqual(self.oFile.lines[43].line,
                         '    constant con12  : integer;')
        self.assertEqual(
            self.oFile.lines[44].line,
            '    file     file12 : load_file_file open read_mode is load_file_name; -- 4'
        )
        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, dExpected)
    def test_fix_rule_031(self):
        oRule = process.rule_031()
        dExpected = []
        oRule.fix(self.oFile)
#        utils.debug_lines(self.oFile, 22, 11)
        self.assertEqual(self.oFile.lines[4].line, '  constant con1 : integer;')
        self.assertEqual(self.oFile.lines[5].line, '  signal sig1 : std_logic; -- Sig')
        self.assertEqual(self.oFile.lines[6].line, '  file file1 : load_file_file open read_mode is load_file_name;')
        self.assertEqual(self.oFile.lines[21].line, '    variable var1 : boolean;')
        self.assertEqual(self.oFile.lines[22].line, '    constant con1 : integer := 1;')
        self.assertEqual(self.oFile.lines[23].line, '    file     file1 : load_file_file open read_mode is load_file_name; -- 1')
        self.assertEqual(self.oFile.lines[27].line, '')
        self.assertEqual(self.oFile.lines[24].line, '    variable var12 : boolean;')
        self.assertEqual(self.oFile.lines[25].line, '    constant con12 : integer;')
        self.assertEqual(self.oFile.lines[26].line, '    file     file12 : load_file_file open read_mode is load_file_name; -- 2')

        self.assertEqual(self.oFile.lines[34].line, '    variable var1 : boolean;')
        self.assertEqual(self.oFile.lines[35].line, '    constant con1 : integer;')
        self.assertEqual(self.oFile.lines[36].line, '    file     file1 : load_file_file open read_mode is load_file_name; -- 3')
        self.assertEqual(self.oFile.lines[37].line, '')
        self.assertEqual(self.oFile.lines[38].line, '    variable var12 : boolean;')
        self.assertEqual(self.oFile.lines[39].line, '    constant con12 : integer;')
        self.assertEqual(self.oFile.lines[40].line, '    file     file12 : load_file_file open read_mode is load_file_name; -- 4')


        self.assertEqual(self.oFile.lines[62].line, '    variable var1 : boolean;')
        self.assertEqual(self.oFile.lines[63].line, '    constant con1 : integer := 1;')
        self.assertEqual(self.oFile.lines[64].line, '    file     file1 : load_file_file open read_mode is load_file_name; -- 7')


        self.assertEqual(self.oFile.lines[67].line, '      variable a, b : integer;')

        self.assertEqual(self.oFile.lines[71].line, '    variable var1 : boolean;')
        self.assertEqual(self.oFile.lines[72].line, '    constant con1 : integer := 1;')
        self.assertEqual(self.oFile.lines[73].line, '    file     file1 : load_file_file open read_mode is load_file_name; -- 8')

        self.assertEqual(self.oFile.lines[76].line, '      variable c, d : integer;')

        self.assertEqual(self.oFile.lines[80].line, '    variable var1 : boolean;')
        self.assertEqual(self.oFile.lines[81].line, '    constant con1 : integer := 1;')
        self.assertEqual(self.oFile.lines[82].line, '    file     file1 : load_file_file open read_mode is load_file_name; -- 9')

        self.assertEqual(self.oFile.lines[90].line, '    variable a, b : integer;')
        self.assertEqual(self.oFile.lines[91].line, '    variable c : integer;')

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, dExpected)
Exemple #5
0
 def test_031(self):
     oRule = process.rule_031()
     oRule.analyze(self.oFile)
     lExpected = ['22-32', '36-46']
     self.assertEqual(oRule.violations, lExpected)
 def test_031(self):
     oRule = process.rule_031()
     oRule.analyze(self.oFile)
     lExpected = ['19-28','60-84']
     self.assertEqual(oRule.violations, lExpected)