1
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-12-10 08:01:21 +04:00

Replaced all Assert.Contains with strict Assert.Equal in tests for better validation

This commit is contained in:
bird_egop
2025-04-13 03:38:50 +03:00
parent 0d271abdcb
commit b2929c38e9
5 changed files with 21 additions and 60 deletions

View File

@@ -12,25 +12,6 @@ using X86Disassembler.X86.Handlers.Inc;
/// </summary>
public class HandlerSelectionTests
{
/// <summary>
/// Tests that the Group1SignExtendedHandler is selected for the 0x83 opcode
/// </summary>
[Fact]
public void InstructionHandlerFactory_SelectsGroup1SignExtendedHandler_For0x83Opcode()
{
// 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);
// Act
var handler = factory.GetHandler(0x83);
// Assert
Assert.NotNull(handler);
Assert.IsType<Group1SignExtendedHandler>(handler);
}
/// <summary>
/// Tests that the IncRegHandler is NOT selected for the 0x83 opcode
/// </summary>
@@ -71,7 +52,7 @@ public class HandlerSelectionTests
// Second instruction should be ADD ecx, imm8
Assert.Equal("add", instructions[1].Mnemonic);
Assert.Contains("ecx", instructions[1].Operands);
Assert.Equal("ecx, 0x00000004", instructions[1].Operands);
// Third instruction should be PUSH eax
Assert.Equal("push", instructions[2].Mnemonic);