def test(): text = ["", "library ieee;", "", "library ieee;", ""] it.assertDictEqual( {"ieee": {"end": 12, "lnum": 1, "start": 8, "type": "library"}}, static_check._getObjectsFromText(text), )
def test(): objects = static_check._getObjectsFromText(it.text) it.assertCountEqual( [LibraryShouldBeOmited(line_number=3, column_number=8, library="work")], static_check._getMiscChecks(objects), )
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.assertCountEqual([], static_check._getMiscChecks(objects))
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), )
def test(): objects = static_check._getObjectsFromText(it.text) it.assertCountEqual( ["ieee"], static_check._getUnusedObjects(it.text, objects) )
def test(): it.assertDictEqual( {"ieee": {"end": 12, "lnum": 0, "start": 8, "type": "library"}}, static_check._getObjectsFromText(it.text), )
def test(): objects = static_check._getObjectsFromText(it.text) it.assertCountEqual( ["basic_library", "DIVIDER_A", "DIVIDER_B", "clk_in_b", "clk_out_b"], static_check._getUnusedObjects(it.text, objects), )
@it.should("not scan after specific end of scan delimiters") # type: ignore @params( [" u0 : some_unit", " generic map ("], [" u0 : some_unit", " port map ("], [" u0 : entity work.some_unit"], [" p0 : process"], [" 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") # type: ignore @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;",