mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-20 08:18:36 +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 CmpInstructionTests
|
||||
|
||||
// Assert
|
||||
Assert.Single(instructions);
|
||||
Assert.Equal("cmp", instructions[0].Mnemonic);
|
||||
Assert.Equal("eax, edi", instructions[0].Operands);
|
||||
Assert.Equal(InstructionType.Cmp, 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 registerOperand1 = (RegisterOperand)eaxOperand;
|
||||
Assert.Equal(RegisterIndex.A, registerOperand1.Register);
|
||||
Assert.Equal(32, registerOperand1.Size); // Validate that it's a 32-bit register (EAX)
|
||||
|
||||
// Check the second operand (EDI)
|
||||
var ediOperand = instructions[0].StructuredOperands[1];
|
||||
Assert.IsType<RegisterOperand>(ediOperand);
|
||||
var registerOperand2 = (RegisterOperand)ediOperand;
|
||||
Assert.Equal(RegisterIndex.Di, registerOperand2.Register);
|
||||
Assert.Equal(32, registerOperand2.Size); // Validate that it's a 32-bit register (EDI)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -41,7 +58,23 @@ public class CmpInstructionTests
|
||||
|
||||
// Assert
|
||||
Assert.Single(instructions);
|
||||
Assert.Equal("cmp", instructions[0].Mnemonic);
|
||||
Assert.Equal("eax, dword ptr [eax]", instructions[0].Operands);
|
||||
Assert.Equal(InstructionType.Cmp, 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