forked from PAWPAW-Mirror/lib_xua
Initial MIDI Rx test using pyxsim
This commit is contained in:
@@ -6,7 +6,7 @@ import Pyxsim
|
||||
from Pyxsim import testers
|
||||
from pathlib import Path
|
||||
from uart_tx_checker import UARTTxChecker
|
||||
|
||||
from midi_test_helpers import midi_expect_tx, create_midi_tx_file
|
||||
|
||||
MAX_CYCLES = 15000000
|
||||
MIDI_RATE = 31250
|
||||
@@ -14,28 +14,6 @@ CONFIGS = ["xs2", "xs3"]
|
||||
CONFIGS = ["xs3"]
|
||||
|
||||
|
||||
class Midi_expect:
|
||||
def __init(self):
|
||||
pass
|
||||
|
||||
def expect(self, commands):
|
||||
expected = ""
|
||||
for command in commands:
|
||||
while len(command) < 3:
|
||||
command.append(0)
|
||||
expected += "uart_tx_checker: " + " ".join([f"0x{byte:02x}" for byte in command]) + "\n"
|
||||
|
||||
return expected
|
||||
|
||||
|
||||
def create_midi_tx_file(commands):
|
||||
with open("midi_tx_cmds.txt", "wt") as mt:
|
||||
for command in commands:
|
||||
while len(command) < 3:
|
||||
command.append(0)
|
||||
text = " ".join([str(byte) for byte in command]) + "\n"
|
||||
mt.write(text)
|
||||
|
||||
#####
|
||||
# This test builds the spdif transmitter app with a verity of presets and tests that the output matches those presets
|
||||
#####
|
||||
@@ -46,7 +24,7 @@ def test_tx(capfd, config):
|
||||
midi_commands = [[0x90, 60, 81]]
|
||||
create_midi_tx_file(midi_commands)
|
||||
|
||||
tester = testers.ComparisonTester(Midi_expect().expect(midi_commands),
|
||||
tester = testers.ComparisonTester(midi_expect_tx().expect(midi_commands),
|
||||
regexp = "uart_tx_checker:.+",
|
||||
ordered = True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user