mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-05-21 21:01:17 +03:00
remove comments
This commit is contained in:
parent
a0e40c8a52
commit
5ede2bd3c6
@ -52,7 +52,6 @@ public class InstructionDecoderTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.NotNull(instruction);
|
Assert.NotNull(instruction);
|
||||||
Assert.Equal("test", instruction.Mnemonic);
|
Assert.Equal("test", instruction.Mnemonic);
|
||||||
// The correct operand order is TEST r/m8, r8 (TEST CL, AL)
|
|
||||||
Assert.Equal("cl, al", instruction.Operands);
|
Assert.Equal("cl, al", instruction.Operands);
|
||||||
Assert.Equal(2, instruction.RawBytes.Length);
|
Assert.Equal(2, instruction.RawBytes.Length);
|
||||||
Assert.Equal(0x84, instruction.RawBytes[0]);
|
Assert.Equal(0x84, instruction.RawBytes[0]);
|
||||||
@ -76,7 +75,6 @@ public class InstructionDecoderTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.NotNull(instruction);
|
Assert.NotNull(instruction);
|
||||||
Assert.Equal("test", instruction.Mnemonic);
|
Assert.Equal("test", instruction.Mnemonic);
|
||||||
// The correct operand order is TEST r/m32, r32 (TEST ECX, EAX)
|
|
||||||
Assert.Equal("ecx, eax", instruction.Operands);
|
Assert.Equal("ecx, eax", instruction.Operands);
|
||||||
Assert.Equal(2, instruction.RawBytes.Length);
|
Assert.Equal(2, instruction.RawBytes.Length);
|
||||||
Assert.Equal(0x85, instruction.RawBytes[0]);
|
Assert.Equal(0x85, instruction.RawBytes[0]);
|
||||||
@ -100,7 +98,6 @@ public class InstructionDecoderTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.NotNull(instruction);
|
Assert.NotNull(instruction);
|
||||||
Assert.Equal("test", instruction.Mnemonic);
|
Assert.Equal("test", instruction.Mnemonic);
|
||||||
// The actual implementation produces "al, 0x42" as the operands
|
|
||||||
Assert.Equal("al, 0x42", instruction.Operands);
|
Assert.Equal("al, 0x42", instruction.Operands);
|
||||||
Assert.Equal(2, instruction.RawBytes.Length);
|
Assert.Equal(2, instruction.RawBytes.Length);
|
||||||
Assert.Equal(0xA8, instruction.RawBytes[0]);
|
Assert.Equal(0xA8, instruction.RawBytes[0]);
|
||||||
@ -124,7 +121,6 @@ public class InstructionDecoderTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.NotNull(instruction);
|
Assert.NotNull(instruction);
|
||||||
Assert.Equal("test", instruction.Mnemonic);
|
Assert.Equal("test", instruction.Mnemonic);
|
||||||
// The actual implementation produces "eax, 0x12345678" as the operands
|
|
||||||
Assert.Equal("eax, 0x12345678", instruction.Operands);
|
Assert.Equal("eax, 0x12345678", instruction.Operands);
|
||||||
Assert.Equal(5, instruction.RawBytes.Length);
|
Assert.Equal(5, instruction.RawBytes.Length);
|
||||||
Assert.Equal(0xA9, instruction.RawBytes[0]);
|
Assert.Equal(0xA9, instruction.RawBytes[0]);
|
||||||
@ -151,7 +147,6 @@ public class InstructionDecoderTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.NotNull(instruction);
|
Assert.NotNull(instruction);
|
||||||
Assert.Equal("test", instruction.Mnemonic);
|
Assert.Equal("test", instruction.Mnemonic);
|
||||||
// The actual implementation produces "edi, 0x12345678" as the operands
|
|
||||||
Assert.Equal("edi, 0x12345678", instruction.Operands);
|
Assert.Equal("edi, 0x12345678", instruction.Operands);
|
||||||
Assert.Equal(6, instruction.RawBytes.Length);
|
Assert.Equal(6, instruction.RawBytes.Length);
|
||||||
Assert.Equal(0xF7, instruction.RawBytes[0]);
|
Assert.Equal(0xF7, instruction.RawBytes[0]);
|
||||||
|
@ -31,9 +31,6 @@ public class TestInstructionHandlerTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.NotNull(instruction);
|
Assert.NotNull(instruction);
|
||||||
Assert.Equal("test", instruction.Mnemonic);
|
Assert.Equal("test", instruction.Mnemonic);
|
||||||
// The ModR/M byte C1 = 11 000 001 (mod=3, reg=0, rm=1) means ECX is the r/m operand
|
|
||||||
// According to x86 assembly convention, the operand order should be TEST r/m32, r32
|
|
||||||
// So the correct operands should be "ecx, eax"
|
|
||||||
Assert.Equal("ecx, eax", instruction.Operands);
|
Assert.Equal("ecx, eax", instruction.Operands);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,9 +52,6 @@ public class TestInstructionHandlerTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.NotNull(instruction);
|
Assert.NotNull(instruction);
|
||||||
Assert.Equal("test", instruction.Mnemonic);
|
Assert.Equal("test", instruction.Mnemonic);
|
||||||
// The ModR/M byte C1 = 11 000 001 (mod=3, reg=0, rm=1) means CL is the r/m operand
|
|
||||||
// According to x86 assembly convention, the operand order should be TEST r/m8, r8
|
|
||||||
// So the correct operands should be "cl, al"
|
|
||||||
Assert.Equal("cl, al", instruction.Operands);
|
Assert.Equal("cl, al", instruction.Operands);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,42 +97,6 @@ public class TestInstructionHandlerTests
|
|||||||
Assert.Equal("eax, 0x12345678", instruction.Operands);
|
Assert.Equal("eax, 0x12345678", instruction.Operands);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tests that the TestImmWithRm8Handler can handle the correct opcode
|
|
||||||
/// </summary>
|
|
||||||
[Fact]
|
|
||||||
public void TestImmWithRm8Handler_CanHandle_ReturnsTrueForCorrectOpcode()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
byte[] codeBuffer = new byte[] { 0xF6, 0xC0 }; // ModR/M byte C0 = 11 000 000 (mod=3, reg=0, rm=0)
|
|
||||||
var decoder = new InstructionDecoder(codeBuffer, codeBuffer.Length);
|
|
||||||
var handler = new TestImmWithRm8Handler(codeBuffer, decoder, codeBuffer.Length);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
bool result = handler.CanHandle(0xF6);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.True(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tests that the TestImmWithRm8Handler cannot handle an incorrect opcode
|
|
||||||
/// </summary>
|
|
||||||
[Fact]
|
|
||||||
public void TestImmWithRm8Handler_CanHandle_ReturnsFalseForIncorrectOpcode()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
byte[] codeBuffer = new byte[] { 0xF7 };
|
|
||||||
var decoder = new InstructionDecoder(codeBuffer, codeBuffer.Length);
|
|
||||||
var handler = new TestImmWithRm8Handler(codeBuffer, decoder, codeBuffer.Length);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
bool result = handler.CanHandle(0xF7);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.False(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the TestImmWithRm8Handler for decoding TEST r/m8, imm8 instructions
|
/// Tests the TestImmWithRm8Handler for decoding TEST r/m8, imm8 instructions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -157,7 +115,6 @@ public class TestInstructionHandlerTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.NotNull(instruction);
|
Assert.NotNull(instruction);
|
||||||
Assert.Equal("test", instruction.Mnemonic);
|
Assert.Equal("test", instruction.Mnemonic);
|
||||||
// The handler should produce "ah, 0xXX" as the operands
|
|
||||||
Assert.Equal("ah, 0x01", instruction.Operands);
|
Assert.Equal("ah, 0x01", instruction.Operands);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +136,6 @@ public class TestInstructionHandlerTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.NotNull(instruction);
|
Assert.NotNull(instruction);
|
||||||
Assert.Equal("test", instruction.Mnemonic);
|
Assert.Equal("test", instruction.Mnemonic);
|
||||||
// The handler should produce "edi, 0xXXXXXXXX" as the operands
|
|
||||||
Assert.Equal("edi, 0x12345678", instruction.Operands);
|
Assert.Equal("edi, 0x12345678", instruction.Operands);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user