Skip to content

TestHarness<TCycle> Class ​

Definition ​

Base class for emulator test harnesses.

c#
public abstract class TestHarness<TCycle>

View source

Type Parameters ​

NameDescription
TCycleThe type used to represent recorded cycles.

Constructors ​

NameDescription
TestHarness()

Properties ​

NameDescription
CyclesGets the recorded CPU cycles. Only available when RecordCycles is true.
MutableCyclesA mutable list of recorded cycles to update when RecordCycles is true, null otherwise.
RecordCyclesGets or sets whether CPU cycles should be recorded.
TStatesGets or sets the number of cycles executed.

Methods ​

NameDescription
AssertEqual<T>(T, T, DefaultInterpolatedStringHandler)Asserts that the actual value is equal to the expected value. If the values are not equal, an error is reported.
AssertFail(String)Signals that a test has failed with the provided error message.
ClearMemory()Clears memory.
CopyToMemory(UInt16, ReadOnlySpan<Byte>)Copies a span of bytes into memory starting at the specified address.
CopyToMemory(UInt16, IReadOnlyList<Byte>)Copies a sequence of bytes into memory starting at the specified address.
CreateAssertionScope(String)Creates an assertion scope that allows multiple AssertEqual<T>(T, T, DefaultInterpolatedStringHandler) assertions to be made with just one AssertFail(String).
ReadByteFromMemory(UInt16)Reads a byte from memory.
ReadWordFromMemory(UInt16)Reads a word in little-endian format from memory.
Reset()Resets the test harness state.
WriteByteToMemory(UInt16, Byte)Writes a byte to memory.
WriteWordToMemory(UInt16, UInt16)Writes a word in little-endian format to memory.