0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-06-20 00:18:02 +03:00

add misc handlers, cleanup and fixes

This commit is contained in:
bird_egop
2025-04-17 20:47:51 +03:00
parent 124493cd94
commit a9d4c39717
22 changed files with 1086 additions and 63 deletions

View File

@ -27,7 +27,7 @@ public class DebugHandlerRegistration
// Create a factory
byte[] codeBuffer = new byte[1];
var decoder = new InstructionDecoder(codeBuffer, codeBuffer.Length);
var sut = new InstructionHandlerFactory(codeBuffer, decoder, codeBuffer.Length);
var sut = new InstructionHandlerFactory(decoder);
// Get the handlers registered in the factory
var handlers = (List<IInstructionHandler>)sut.GetType()

View File

@ -18,7 +18,7 @@ public class HandlerSelectionTests
// Arrange
byte[] codeBuffer = new byte[] {0x83, 0xC1, 0x04}; // ADD ecx, 0x04
var decoder = new InstructionDecoder(codeBuffer, codeBuffer.Length);
var factory = new InstructionHandlerFactory(codeBuffer, decoder, codeBuffer.Length);
var factory = new InstructionHandlerFactory(decoder);
// Act
var handler = factory.GetHandler(0x83);

View File

@ -10,7 +10,7 @@ public class InstructionHandlerFactoryTests
public void Factory_ShouldNotContainDuplicates()
{
byte[] code = new byte[] {0xCC, 0xCC, 0xCC};
var sut = new InstructionHandlerFactory(code, new InstructionDecoder(code, code.Length), code.Length);
var sut = new InstructionHandlerFactory(new InstructionDecoder(code, code.Length));
var handlers = (List<IInstructionHandler>) sut.GetType()
.GetField("_handlers", BindingFlags.Instance | BindingFlags.NonPublic)!
@ -26,7 +26,7 @@ public class InstructionHandlerFactoryTests
public void Factory_ShouldContainAllKnownHandlers()
{
byte[] code = new byte[] {0xCC, 0xCC, 0xCC};
var sut = new InstructionHandlerFactory(code, new InstructionDecoder(code, code.Length), code.Length);
var sut = new InstructionHandlerFactory(new InstructionDecoder(code, code.Length));
var handlers = (List<IInstructionHandler>) sut.GetType()
.GetField("_handlers", BindingFlags.Instance | BindingFlags.NonPublic)!