diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2024-04-14 15:15:26 +0300 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2024-04-14 15:15:26 +0300 |
| commit | 030dfe49770997282bb214bb90d9b875eb26d6f2 (patch) | |
| tree | 663341b16852f412f570fbc7341c2660510db299 /test/e2e/fibo/test_fibo.py | |
| parent | 2f563af1c27f232abc0516348aa08e1f6e0a20f2 (diff) | |
Refactor some tests
Diffstat (limited to 'test/e2e/fibo/test_fibo.py')
| -rw-r--r-- | test/e2e/fibo/test_fibo.py | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/test/e2e/fibo/test_fibo.py b/test/e2e/fibo/test_fibo.py index 664e701..14760e0 100644 --- a/test/e2e/fibo/test_fibo.py +++ b/test/e2e/fibo/test_fibo.py @@ -1,27 +1,8 @@ -import time -from atk16_asm import assemble -from atk16_emu import Machine -from test.utils import pad_bytearray +from test.utils import assemble_and_run_until_halted def test_fibo(): - filename = "test/e2e/fibo/fibo.atk16" - with open(filename, "r") as f: - source = f.read() - - obj = assemble(source, filename) - rom_image = pad_bytearray(obj.program) - - machine = Machine() - machine.load_rom_image(rom_image) - machine.reset() - start = time.perf_counter_ns() - machine.run_until_halted() - end = time.perf_counter_ns() - machine.print_state_summary() - - elapsed = end - start - print("Elapsed time:", elapsed, "ns") - steps_taken = machine.steps_taken - print("Instructions / second:", steps_taken / (elapsed / 1e9)) + machine = assemble_and_run_until_halted( + "test/e2e/fibo/fibo.atk16" + ) assert machine.ra.value == 41443 |
