Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions tests/runtime/check_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import zx


class Stop(Exception):
pass


class Tester(zx.Emulator):
def __init__(self):
# speed_factor=None results in maximum speed and
Expand All @@ -13,7 +17,7 @@ def __init__(self):
super().__init__(speed_factor=None)

def on_breakpoint(self):
self.stop()
raise Stop

def run_test(self, tape_filename, ram_filename):
# Auto-load the tape.
Expand All @@ -22,8 +26,11 @@ def run_test(self, tape_filename, ram_filename):
# Catch the end of test.
self.set_breakpoint(8)

# Run the main loop until self.done is raised.
self.run()
# Run the main loop.
try:
self.run()
except Stop:
pass

# Get view to the video memory.
screen = self.get_memory_view(0x4000, 6 * 1024 + 768)
Expand Down
13 changes: 10 additions & 3 deletions tests/runtime/update_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import zx


class Stop(Exception):
pass


class TakeSnapshot(zx.Emulator):
def __init__(self):
# speed_factor=None results in maximum speed and
Expand All @@ -25,13 +29,16 @@ def run_test(self, filename):
# Catch the end of test.
self.set_breakpoint(8)

# Run the main loop until self.done is raised.
self.run()
# Run the main loop.
try:
self.run()
except Stop:
pass

# Get view to the video memory.
screen = self.get_memory_view(0x4000, 6 * 1024 + 768)

# Compare it with the etalon screenshot.
# Take screenshot.
with open(filename + '.scr', 'wb') as f:
f.write(screen)

Expand Down