mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-19 16:08:02 +03:00
Added support for DEC r32 instructions (0x48-0x4F) with tests
This commit is contained in:
68
X86DisassemblerTests/DecInstructionTests.cs
Normal file
68
X86DisassemblerTests/DecInstructionTests.cs
Normal file
@ -0,0 +1,68 @@
|
||||
namespace X86DisassemblerTests;
|
||||
|
||||
using System;
|
||||
using Xunit;
|
||||
using X86Disassembler.X86;
|
||||
|
||||
/// <summary>
|
||||
/// Tests for DEC instruction handlers
|
||||
/// </summary>
|
||||
public class DecInstructionTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests the DEC EAX instruction (0x48)
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void TestDecEax()
|
||||
{
|
||||
// Arrange
|
||||
byte[] code = { 0x48 }; // DEC EAX
|
||||
|
||||
// Act
|
||||
Disassembler disassembler = new Disassembler(code, 0x1000);
|
||||
var instructions = disassembler.Disassemble();
|
||||
|
||||
// Assert
|
||||
Assert.Single(instructions);
|
||||
Assert.Equal("dec", instructions[0].Mnemonic);
|
||||
Assert.Equal("eax", instructions[0].Operands);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the DEC ECX instruction (0x49)
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void TestDecEcx()
|
||||
{
|
||||
// Arrange
|
||||
byte[] code = { 0x49 }; // DEC ECX
|
||||
|
||||
// Act
|
||||
Disassembler disassembler = new Disassembler(code, 0x1000);
|
||||
var instructions = disassembler.Disassemble();
|
||||
|
||||
// Assert
|
||||
Assert.Single(instructions);
|
||||
Assert.Equal("dec", instructions[0].Mnemonic);
|
||||
Assert.Equal("ecx", instructions[0].Operands);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the DEC EDI instruction (0x4F)
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void TestDecEdi()
|
||||
{
|
||||
// Arrange
|
||||
byte[] code = { 0x4F }; // DEC EDI
|
||||
|
||||
// Act
|
||||
Disassembler disassembler = new Disassembler(code, 0x1000);
|
||||
var instructions = disassembler.Disassemble();
|
||||
|
||||
// Assert
|
||||
Assert.Single(instructions);
|
||||
Assert.Equal("dec", instructions[0].Mnemonic);
|
||||
Assert.Equal("edi", instructions[0].Operands);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user