diff options
author | Juan J. MartÃnez <jjm@usebox.net> | 2019-08-07 06:49:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-07 06:49:29 +0100 |
commit | d6c52edb57bbd63169b184f81db6ad56b9434215 (patch) | |
tree | 033d7fb7013ac616afb4c5c22ea67e7c8a5b597e /tests/test_parser.py | |
parent | 09260b3ade51201b99b945cb0d9db7cdcf10d82c (diff) | |
parent | fd9f4e10bf775303d19273feaf327b4f5c52a74a (diff) | |
download | z80count-d6c52edb57bbd63169b184f81db6ad56b9434215.tar.gz z80count-d6c52edb57bbd63169b184f81db6ad56b9434215.zip |
Merge pull request #14 from patxoca/issue-11
Fix issue 11
Diffstat (limited to 'tests/test_parser.py')
-rw-r--r-- | tests/test_parser.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_parser.py b/tests/test_parser.py index 3153415..b6ab468 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -918,6 +918,10 @@ def test_lookup(instruction, cycles, parser_table): assert entry["cycles"] == cycles, "Failed: {} expected '{}' != found '{}'".format(instruction, cycles, entry["cycles"]) +########################################################################## +# _extract_mnemonic # +########################################################################## + @pytest.mark.parametrize("line,operator", ( ("foo: LD A, 1 ; load accumulator", "LD"), ("foo: CALL 0xABCD", "CALL"), @@ -935,3 +939,22 @@ def test_extract_mnemonic(line, operator): def test_extract_mnemonic_normalizes_operator(): assert Parser._extract_mnemonic("call 0xabcd") == "CALL" + + +########################################################################## +# _remove_label # +########################################################################## + +@pytest.mark.parametrize("line,expected", ( + ("foo: ld A, 1 ; load accumulator", "ld A, 1 ; load accumulator"), + ("foo: CALL 0xABCD", "CALL 0xABCD"), + ("foo: EI", "EI"), + ("LD A, 1 ; load accumulator", "LD A, 1 ; load accumulator"), + ("call 0xABCE", "call 0xABCE"), + ("EI", "EI"), + ("foo: ; some label", None), + ("foo:", None), + ("; some comment", None), +)) +def test_remove_label(line, expected): + assert Parser._remove_label(line) == expected |