Adafruit_CircuitPython_PIOASM/tests/test_all.py
Jeff Epler 89fc1a125a Add (failing) test comparing "all" instructions to sdk pioasm
the failing tests will be addressed next. They fall into two simple
classes, both pertaining to the new piov1 instructions.
2024-09-13 16:01:53 -05:00

31 lines
823 B
Python

# SPDX-FileCopyrightText: 2024 Jeff Epler, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import pytest
from pytest_helpers import assert_assembles_to
import all_pio_instructions
def _assert_one(expected, instruction_in, fifo="putget"):
program = f"""
.program all_pio
.pio_version 1
.fifo {fifo}
{instruction_in}
"""
assert_assembles_to(program, [expected])
def assert_one(expected, instruction_in):
if isinstance(instruction_in, str):
return _assert_one(expected, instruction_in)
return _assert_one(expected, instruction_in[0], **instruction_in[1])
@pytest.mark.parametrize("arg", all_pio_instructions.all_instruction.items())
def test_all(arg):
expected = arg[0]
instruction = arg[1]
assert_one(expected, instruction)