mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-19 16:08:02 +03:00
unbreak tests
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
using CsvHelper.Configuration;
|
||||
using X86Disassembler.X86;
|
||||
using X86Disassembler.X86.Operands;
|
||||
|
||||
namespace X86DisassemblerTests;
|
||||
|
||||
@ -20,9 +22,13 @@ public class TestFromFileEntry
|
||||
|
||||
public class TestFromFileInstruction
|
||||
{
|
||||
// Keep the old properties for CSV deserialization
|
||||
public string Mnemonic { get; set; } = string.Empty;
|
||||
public string Operands { get; set; } = string.Empty;
|
||||
|
||||
|
||||
// Add new properties for comparison with actual Instruction objects
|
||||
public InstructionType Type => ConvertMnemonicToType(Mnemonic);
|
||||
|
||||
// Parameterless constructor required by CsvHelper
|
||||
public TestFromFileInstruction()
|
||||
{
|
||||
@ -33,6 +39,40 @@ public class TestFromFileInstruction
|
||||
Mnemonic = mnemonic;
|
||||
Operands = operands;
|
||||
}
|
||||
|
||||
// Helper method to convert mnemonic string to InstructionType
|
||||
private InstructionType ConvertMnemonicToType(string mnemonic)
|
||||
{
|
||||
// Convert mnemonic to InstructionType
|
||||
return mnemonic.ToLowerInvariant() switch
|
||||
{
|
||||
"add" => InstructionType.Add,
|
||||
"adc" => InstructionType.Adc,
|
||||
"and" => InstructionType.And,
|
||||
"call" => InstructionType.Call,
|
||||
"cmp" => InstructionType.Cmp,
|
||||
"dec" => InstructionType.Dec,
|
||||
"inc" => InstructionType.Inc,
|
||||
"int3" => InstructionType.Int,
|
||||
"jmp" => InstructionType.Jmp,
|
||||
"jz" => InstructionType.Jz,
|
||||
"jnz" => InstructionType.Jnz,
|
||||
"jge" => InstructionType.Jge,
|
||||
"lea" => InstructionType.Lea,
|
||||
"mov" => InstructionType.Mov,
|
||||
"nop" => InstructionType.Nop,
|
||||
"or" => InstructionType.Or,
|
||||
"pop" => InstructionType.Pop,
|
||||
"push" => InstructionType.Push,
|
||||
"ret" => InstructionType.Ret,
|
||||
"sbb" => InstructionType.Sbb,
|
||||
"sub" => InstructionType.Sub,
|
||||
"test" => InstructionType.Test,
|
||||
"xchg" => InstructionType.Xchg,
|
||||
"xor" => InstructionType.Xor,
|
||||
_ => InstructionType.Unknown
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class TestFromFileEntryMap : ClassMap<TestFromFileEntry>
|
||||
|
Reference in New Issue
Block a user