Example #1
0
 def test():
     it.assertDictEqual(
         {
             'DIVIDER_A': {
                 'end': 18,
                 'lnum': 8,
                 'start': 8,
                 'type': 'generic'
             },
             'DIVIDER_B': {
                 'end': 18,
                 'lnum': 9,
                 'start': 8,
                 'type': 'generic'
             },
             'basic_library': {
                 'end': 21,
                 'lnum': 5,
                 'start': 8,
                 'type': 'library'
             },
             'clk_in_a': {
                 'end': 17,
                 'lnum': 12,
                 'start': 8,
                 'type': 'port'
             },
             'clk_in_b': {
                 'end': 17,
                 'lnum': 15,
                 'start': 8,
                 'type': 'port'
             },
             'clk_out_a': {
                 'end': 18,
                 'lnum': 13,
                 'start': 8,
                 'type': 'port'
             },
             'clk_out_b': {
                 'end': 18,
                 'lnum': 16,
                 'start': 8,
                 'type': 'port'
             },
             'ieee': {
                 'end': 12,
                 'lnum': 0,
                 'start': 8,
                 'type': 'library'
             },
             'work': {
                 'end': 12,
                 'lnum': 3,
                 'start': 8,
                 'type': 'library'
             }
         }, static_check._getObjectsFromText(it.text))
Example #2
0
        def test():

            it.assertDictEqual(
                {
                    'ieee': {
                        'end': 12,
                        'lnum': 0,
                        'start': 8,
                        'type': 'library'
                    }
                }, static_check._getObjectsFromText(it.text))
Example #3
0
        def test():
            objects = static_check._getObjectsFromText(it.text)

            it.assertItemsEqual([{
                'checker': 'HDL Code Checker/static',
                'column': 9,
                'error_message':
                "Declaration of library 'work' can be omitted",
                'error_number': '0',
                'error_subtype': 'Style',
                'error_type': 'W',
                'filename': None,
                'line_number': 4
            }], static_check._getMiscChecks(objects))
Example #4
0
    def test():
        text = [
            '',
            'library ieee;',
            '',
            'library ieee;',
            '',
        ]

        it.assertDictEqual(
            {'ieee': {
                'end': 12,
                'lnum': 3,
                'start': 8,
                'type': 'library'
            }}, static_check._getObjectsFromText(text))
Example #5
0
    def test():
        text = [
            'entity foo is',
            '    port (',
            '        clk_in_a : in std_logic;',
            '        clk_out_a : out std_logic;',
            '',
            '        clk_in_b : in std_logic;',
            '        clk_out_b : out std_logic',
            '',
            '    );',
            'end foo;',
        ]

        objects = static_check._getObjectsFromText(text)

        it.assertItemsEqual([], static_check._getMiscChecks(objects))
Example #6
0
 def test():
     objects = static_check._getObjectsFromText(it.text)
     it.assertItemsEqual([
         'ieee',
     ], static_check._getUnusedObjects(it.text, objects))
Example #7
0
 def test():
     objects = static_check._getObjectsFromText(it.text)
     it.assertItemsEqual([
         'basic_library', 'DIVIDER_A', 'DIVIDER_B', 'clk_in_b',
         'clk_out_b'
     ], static_check._getUnusedObjects(it.text, objects))
Example #8
0
            " process(clk)",
        ],
    )
    def test(case, parm):
        _logger.info("Running test case '%s'", case)
        text = [
            'library foo;',
        ] + parm + ['library bar;']

        it.assertDictEqual(
            {'foo': {
                'end': 11,
                'lnum': 0,
                'start': 8,
                'type': 'library'
            }}, static_check._getObjectsFromText(text))

    @it.should("extract comment tags")
    @params(" -- XXX: some warning", " -- TODO: something to do",
            " -- FIXME: something to fix")
    def test(case, parm):
        _logger.info("Running test case '%s'", case)
        expected = re.sub(r"\s*--\s*", "", parm)

        text = [
            'library ieee;', '    use ieee.std_logic_1164.all;',
            '    use ieee.numeric_std.all;', 'library basic_library;',
            'entity foo is', '', parm, '', '    generic (',
            '        DIVIDER_A : integer := 10;',
            '        DIVIDER_B : integer := 20', '    );', '    port (',
            '        clk_in_a : in std_logic;',