ft: add first basic test
This commit is contained in:
@@ -829,3 +829,36 @@ impl Disassembler {
|
||||
Ok(instructions)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_basic() {
|
||||
let text = Vec::from([0x0, 0x0]);
|
||||
let mut disassembler = Disassembler {
|
||||
offset: 0,
|
||||
text,
|
||||
instruction: Instruction::new(),
|
||||
};
|
||||
let instructions = disassembler.decode_instructions().ok();
|
||||
if let Some(instrs) = instructions {
|
||||
assert_eq!(
|
||||
instrs[0],
|
||||
Instruction {
|
||||
start: 0,
|
||||
raw: Vec::from([0, 0]),
|
||||
opcode: Mnemonic::ADD_FromReg(
|
||||
ModRmTarget::Memory(MemoryIndex {
|
||||
base: Some(Register::BX),
|
||||
index: Some(Register::SI),
|
||||
displacement: None
|
||||
}),
|
||||
Register::AL
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user