mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-19 16:08:02 +03:00
fixes and removed unused code
This commit is contained in:
@ -15,7 +15,7 @@ public class CmpInstructionSequenceTests
|
||||
public void CmpImmWithRm8_ComplexMemoryOperand_Correctly()
|
||||
{
|
||||
// Arrange
|
||||
// CMP BYTE PTR [EBP], 0x03 (80 7D 00 03)
|
||||
// CMP BYTE PTR [EBP+0x0], 0x03 (80 7D 00 03)
|
||||
byte[] codeBuffer = new byte[] { 0x80, 0x7D, 0x00, 0x03 };
|
||||
var disassembler = new Disassembler(codeBuffer, 0x1C46);
|
||||
|
||||
@ -32,9 +32,10 @@ public class CmpInstructionSequenceTests
|
||||
|
||||
// Check the first operand (memory operand)
|
||||
var memoryOperand = instruction.StructuredOperands[0];
|
||||
Assert.IsType<BaseRegisterMemoryOperand>(memoryOperand);
|
||||
var memory = (BaseRegisterMemoryOperand)memoryOperand;
|
||||
Assert.IsType<DisplacementMemoryOperand>(memoryOperand);
|
||||
var memory = (DisplacementMemoryOperand)memoryOperand;
|
||||
Assert.Equal(RegisterIndex.Bp, memory.BaseRegister); // Base register is ECX
|
||||
Assert.Equal(0, memory.Displacement); // displacement should be 0x0
|
||||
Assert.Equal(8, memory.Size); // Memory size is 8 bits (BYTE)
|
||||
|
||||
// Check the second operand (immediate value)
|
||||
@ -51,7 +52,7 @@ public class CmpInstructionSequenceTests
|
||||
public void CmpImmWithRm8_FollowedByJge_Correctly()
|
||||
{
|
||||
// Arrange
|
||||
// CMP BYTE PTR [EBP], 0x03 (80 7D 00 03)
|
||||
// CMP BYTE PTR [EBP+0x0], 0x03 (80 7D 00 03)
|
||||
// JGE +5 (7D 05)
|
||||
byte[] codeBuffer = new byte[] { 0x80, 0x7D, 0x00, 0x03, 0x7D, 0x05 };
|
||||
var disassembler = new Disassembler(codeBuffer, 0x1C46);
|
||||
@ -71,9 +72,10 @@ public class CmpInstructionSequenceTests
|
||||
|
||||
// Check the first operand (memory operand)
|
||||
var memoryOperand = cmpInstruction.StructuredOperands[0];
|
||||
Assert.IsType<BaseRegisterMemoryOperand>(memoryOperand);
|
||||
var memory = (BaseRegisterMemoryOperand)memoryOperand;
|
||||
Assert.IsType<DisplacementMemoryOperand>(memoryOperand);
|
||||
var memory = (DisplacementMemoryOperand)memoryOperand;
|
||||
Assert.Equal(RegisterIndex.Bp, memory.BaseRegister); // Base register is ECX
|
||||
Assert.Equal(0, memory.Displacement); // displacement should be 0x0
|
||||
Assert.Equal(8, memory.Size); // Memory size is 8 bits (BYTE)
|
||||
|
||||
// Check the second operand (immediate value)
|
||||
@ -106,7 +108,7 @@ public class CmpInstructionSequenceTests
|
||||
public void CmpJgeSequence_DecodesCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
// CMP BYTE PTR [EBP], 0x03 (80 7D 00 03)
|
||||
// CMP BYTE PTR [EBP+0x0], 0x03 (80 7D 00 03)
|
||||
// JGE +5 (7D 05)
|
||||
// ADD EBP, 0x18 (83 C5 18)
|
||||
// JMP +3 (EB 03)
|
||||
@ -132,9 +134,10 @@ public class CmpInstructionSequenceTests
|
||||
|
||||
// Check the first operand (memory operand)
|
||||
var memoryOperand = cmpInstruction.StructuredOperands[0];
|
||||
Assert.IsType<BaseRegisterMemoryOperand>(memoryOperand);
|
||||
var memory = (BaseRegisterMemoryOperand)memoryOperand;
|
||||
Assert.IsType<DisplacementMemoryOperand>(memoryOperand);
|
||||
var memory = (DisplacementMemoryOperand)memoryOperand;
|
||||
Assert.Equal(RegisterIndex.Bp, memory.BaseRegister); // Base register is ECX
|
||||
Assert.Equal(0, memory.Displacement); // displacement should be is 0x0
|
||||
Assert.Equal(8, memory.Size); // Memory size is 8 bits (BYTE)
|
||||
|
||||
// Check the second operand (immediate value)
|
||||
|
@ -73,9 +73,9 @@ public class InstructionDecoderTests
|
||||
|
||||
// Check the second operand (AL)
|
||||
var alOperand = instruction.StructuredOperands[1];
|
||||
Assert.IsType<RegisterOperand>(alOperand);
|
||||
var alRegisterOperand = (RegisterOperand)alOperand;
|
||||
Assert.Equal(RegisterIndex.A, alRegisterOperand.Register);
|
||||
Assert.IsType<Register8Operand>(alOperand);
|
||||
var alRegisterOperand = (Register8Operand)alOperand;
|
||||
Assert.Equal(RegisterIndex8.AL, alRegisterOperand.Register);
|
||||
Assert.Equal(8, alRegisterOperand.Size); // Validate that it's an 8-bit register (AL)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user