Exemplo n.º 1
0
    def test_create_list_with_configuration(self):
        dConfiguration = {}
        dConfiguration['severity'] = {}
        dSeverity = {}
        dSeverity['type'] = 'warning'
        dConfiguration['severity']['Guideline'] = dSeverity
        dSeverity = {}
        dSeverity['type'] = 'error'
        dConfiguration['severity']['Todo'] = dSeverity

        oSeverityList = severity.create_list(dConfiguration)

        lExpected = []
        lExpected.append(severity.error('Error'))
        lExpected.append(severity.warning('Warning'))
        lExpected.append(severity.warning('Guideline'))
        lExpected.append(severity.error('Todo'))

        lActual = oSeverityList.lSeverities

        self.assertEqual(len(lActual), len(lExpected))

        for iIndex, oExpected in enumerate(lExpected):
            self.assertEqual(lActual[iIndex].name, oExpected.name)
            self.assertEqual(lActual[iIndex].type, oExpected.type)
Exemplo n.º 2
0
    def test_create_list(self):
        oSeverityList = severity.create_list({})
        self.assertEqual(len(oSeverityList.lSeverities), 2)

        self.assertEqual(
            oSeverityList.get_severity_named('Error').name, 'Error')
        self.assertEqual(
            oSeverityList.get_severity_named('Warning').name, 'Warning')
        self.assertIsNone(oSeverityList.get_severity_named('Mine'))
Exemplo n.º 3
0
    def test_create_list_add_severity_method(self):
        oSeverityList = severity.create_list({})
        self.assertEqual(len(oSeverityList.lSeverities), 2)

        oSeverity = severity.warning('Guideline')
        oSeverityList.add_severity(oSeverity)

        self.assertEqual(len(oSeverityList.lSeverities), 3)

        self.assertEqual(
            oSeverityList.get_severity_named('Error').name, 'Error')
        self.assertEqual(
            oSeverityList.get_severity_named('Warning').name, 'Warning')
        self.assertEqual(
            oSeverityList.get_severity_named('Guideline').name, 'Guideline')
        self.assertEqual(
            oSeverityList.get_severity_named('Guideline').type, 'warning')
Exemplo n.º 4
0
lBoardCpu, eBoardCpuError = vhdlFile.utils.read_vhdlfile(
    os.path.join(sSourceDir, 'Board_cpu.vhd'))
oBoardCpu = vhdlFile.vhdlFile(lBoardCpu)
oBoardCpu.set_indent_map(dIndentMap)

lDataCore, eDataCoreError = vhdlFile.utils.read_vhdlfile(
    os.path.join(sSourceDir, 'data_core.vhd'))
oDataCore = vhdlFile.vhdlFile(lDataCore)
oDataCore.set_indent_map(dIndentMap)

oConfig = utils.read_configuration(
    os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'styles',
                 'indent_only.yaml'))

oSeverityList = severity.create_list({})


class testCodeExample(unittest.TestCase):
    def setUp(self):
        self.assertIsNone(eBaudGenError)
        self.assertIsNone(eBoardCpuError)
        self.assertIsNone(eDataCoreError)

    def test_baudgen(self):
        oRuleList = rule_list.rule_list(oBaudGen, oSeverityList)
        oRuleList.configure(oConfig)
        oRuleList.fix(7, oConfig.dConfig['skip_phase'])
        lExpected = ['']
        utils.read_file(os.path.join(os.path.dirname(__file__), 'BaudGen.vhd'),
                        lExpected,