def test_rule_003(self):
     oRule = concurrent.rule_003()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'concurrent')
     self.assertEqual(oRule.identifier, '003')
     dExpected = [28,29,30]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
Beispiel #2
0
    def test_rule_003_align_left_yes_align_paren_yes(self):
        oRule = concurrent.rule_003()
        oRule.align_left = 'yes'
        oRule.align_paren = 'yes'

        lExpected = [8, 11, 14, 17, 20, 21, 22, 23, 24]

        oRule.analyze(self.oFile)
        self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
Beispiel #3
0
    def test_rule_003(self):
        oRule = concurrent.rule_003()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'concurrent')
        self.assertEqual(oRule.identifier, '003')

        lExpected = [14, 17]

        oRule.analyze(self.oFile)
        self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
Beispiel #4
0
    def test_fix_rule_003(self):
        oRule = concurrent.rule_003()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Beispiel #5
0
    def test_rule_003_align_left_no_align_paren_yes(self):
        oRule = concurrent.rule_003()
        oRule.align_left = 'no'
        oRule.align_paren = 'yes'
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'concurrent')
        self.assertEqual(oRule.identifier, '003')

        lExpected = [14, 17, 20, 21, 22, 23, 24]

        oRule.analyze(self.oFile)
        self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
Beispiel #6
0
    def test_fix_rule_003_align_left_yes_align_paren_yes(self):
        oRule = concurrent.rule_003()
        oRule.align_left = 'yes'
        oRule.align_paren = 'yes'

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Beispiel #7
0
    def test_fix_rule_003(self):
        oRule = concurrent.rule_003()
        dExpected = []
        oRule.fix(self.oFile)
        self.assertEqual(self.oFile.lines[32].line, '            \'1\';')
        self.assertEqual(self.oFile.lines[35].line,
                         '                        (I_CRUFT = \'1\')) else')
        self.assertEqual(self.oFile.lines[39].line,
                         '             0 => q_foo(31 downto  0));')
        self.assertEqual(
            self.oFile.lines[42].line,
            '                   unsigned(I_BAR), q_foo\'length);')
        self.assertEqual(
            self.oFile.lines[45].line,
            '                                       I_CRUFT = 1) or')
        self.assertEqual(self.oFile.lines[46].line,
                         '                         I_BLAH = 10));')

        self.assertEqual(
            self.oFile.lines[49].line,
            '                                       (I_CRUFT = 1 or I_BLAH = 10)'
        )
        self.assertEqual(
            self.oFile.lines[50].line,
            '                                       and I_GRUB = 20) or')
        self.assertEqual(self.oFile.lines[51].line,
                         '                                      I_STUB = 45)')
        self.assertEqual(self.oFile.lines[52].line,
                         '                        and I_HUB = 23);')

        self.assertEqual(
            self.oFile.lines[55].line,
            '                                       (I_CRUFT = 1 or')
        self.assertEqual(
            self.oFile.lines[56].line,
            '                                        I_BLAH = 10)')
        self.assertEqual(
            self.oFile.lines[57].line,
            '                                       and I_GRUB = 20) or')
        self.assertEqual(self.oFile.lines[58].line,
                         '                                      I_STUB = 45)')
        self.assertEqual(self.oFile.lines[59].line,
                         '                        and I_HUB = 23);')

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, dExpected)
 def test_fix_rule_003(self):
     oRule = concurrent.rule_003()
     dExpected = []
     oRule.fix(oFile)
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
Beispiel #9
0
 def test_rule_003(self):
     oRule = concurrent.rule_003()
     dExpected = [32, 35, 39, 42, 45, 46, 49, 50, 51, 52, 55, 56]
     oRule.analyze(self.oFile)
     self.assertEqual(oRule.violations, dExpected)