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

unbreak tests

This commit is contained in:
bird_egop
2025-04-14 23:08:52 +03:00
parent 685eeda03d
commit 9117830ff1
41 changed files with 3820 additions and 736 deletions

View File

@ -1,4 +1,5 @@
using X86Disassembler.X86;
using X86Disassembler.X86.Operands;
namespace X86DisassemblerTests.InstructionTests;
@ -22,8 +23,24 @@ public class AddRm32R32Tests
// Assert
Assert.Single(instructions);
Assert.Equal("add", instructions[0].Mnemonic);
Assert.Equal("ecx, 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 (ECX)
var ecxOperand = instructions[0].StructuredOperands[0];
Assert.IsType<RegisterOperand>(ecxOperand);
var registerOperand1 = (RegisterOperand)ecxOperand;
Assert.Equal(RegisterIndex.C, registerOperand1.Register);
Assert.Equal(32, registerOperand1.Size); // Validate that it's a 32-bit register (ECX)
// Check the second operand (EAX)
var eaxOperand = instructions[0].StructuredOperands[1];
Assert.IsType<RegisterOperand>(eaxOperand);
var registerOperand2 = (RegisterOperand)eaxOperand;
Assert.Equal(RegisterIndex.A, registerOperand2.Register);
Assert.Equal(32, registerOperand2.Size); // Validate that it's a 32-bit register (EAX)
}
/// <summary>
@ -41,7 +58,23 @@ public class AddRm32R32Tests
// Assert
Assert.Single(instructions);
Assert.Equal("add", instructions[0].Mnemonic);
Assert.Equal("dword ptr [ecx], 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 (memory operand)
var memoryOperand = instructions[0].StructuredOperands[0];
Assert.IsType<BaseRegisterMemoryOperand>(memoryOperand);
var memory = (BaseRegisterMemoryOperand)memoryOperand;
Assert.Equal(RegisterIndex.C, memory.BaseRegister); // Base register is ECX
Assert.Equal(32, memory.Size); // Memory size is 32 bits (DWORD)
// Check the second operand (EAX)
var eaxOperand = instructions[0].StructuredOperands[1];
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)
}
}