mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-20 16:18:37 +03:00
unbreak tests
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using X86Disassembler.X86;
|
||||
using X86Disassembler.X86.Operands;
|
||||
|
||||
namespace X86DisassemblerTests.InstructionTests;
|
||||
|
||||
@ -22,8 +23,24 @@ public class AddInstructionTests
|
||||
|
||||
// Assert
|
||||
Assert.Single(instructions);
|
||||
Assert.Equal("add", instructions[0].Mnemonic);
|
||||
Assert.Equal("esi, ebp", instructions[0].Operands);
|
||||
Assert.Equal(InstructionType.Add, instructions[0].Type);
|
||||
|
||||
// Check that we have two operands
|
||||
Assert.Equal(2, instructions[0].StructuredOperands.Count);
|
||||
|
||||
// Check the first operand (ESI)
|
||||
var esiOperand = instructions[0].StructuredOperands[0];
|
||||
Assert.IsType<RegisterOperand>(esiOperand);
|
||||
var registerOperand1 = (RegisterOperand)esiOperand;
|
||||
Assert.Equal(RegisterIndex.Si, registerOperand1.Register);
|
||||
Assert.Equal(32, registerOperand1.Size); // Validate that it's a 32-bit register (ESI)
|
||||
|
||||
// Check the second operand (EBP)
|
||||
var ebpOperand = instructions[0].StructuredOperands[1];
|
||||
Assert.IsType<RegisterOperand>(ebpOperand);
|
||||
var registerOperand2 = (RegisterOperand)ebpOperand;
|
||||
Assert.Equal(RegisterIndex.Bp, registerOperand2.Register);
|
||||
Assert.Equal(32, registerOperand2.Size); // Validate that it's a 32-bit register (EBP)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -41,7 +58,23 @@ public class AddInstructionTests
|
||||
|
||||
// Assert
|
||||
Assert.Single(instructions);
|
||||
Assert.Equal("add", instructions[0].Mnemonic);
|
||||
Assert.Equal("eax, dword ptr [eax]", instructions[0].Operands);
|
||||
Assert.Equal(InstructionType.Add, instructions[0].Type);
|
||||
|
||||
// Check that we have two operands
|
||||
Assert.Equal(2, instructions[0].StructuredOperands.Count);
|
||||
|
||||
// Check the first operand (EAX)
|
||||
var eaxOperand = instructions[0].StructuredOperands[0];
|
||||
Assert.IsType<RegisterOperand>(eaxOperand);
|
||||
var registerOperand = (RegisterOperand)eaxOperand;
|
||||
Assert.Equal(RegisterIndex.A, registerOperand.Register);
|
||||
Assert.Equal(32, registerOperand.Size); // Validate that it's a 32-bit register (EAX)
|
||||
|
||||
// Check the second operand (memory operand)
|
||||
var memoryOperand = instructions[0].StructuredOperands[1];
|
||||
Assert.IsType<BaseRegisterMemoryOperand>(memoryOperand);
|
||||
var memory = (BaseRegisterMemoryOperand)memoryOperand;
|
||||
Assert.Equal(RegisterIndex.A, memory.BaseRegister); // Base register is EAX
|
||||
Assert.Equal(32, memory.Size); // Memory size is 32 bits (DWORD)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user