From 6668e8f87a3d2cf814c1ddd77a0eb6fec668c3eb Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 23 Dec 2023 15:41:09 -0800 Subject: more fuzz targets --- src/lib.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 67272b0..68f0819 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,6 +22,25 @@ pub struct Instruction { length: u8, } +impl PartialEq for Instruction { + fn eq(&self, other: &Self) -> bool { + let Instruction { + opcode: left_opcode, + operands: _, // we won't use this `operands`, but `.operands()` to not use stale extra operands + length: left_length, + } = self; + let Instruction { + opcode: right_opcode, + operands: _, // we won't use this `operands`, but `.operands()` to not use stale extra operands + length: right_length, + } = other; + + left_opcode == right_opcode && + left_length == right_length && + self.operands() == other.operands() + } +} + impl Instruction { pub fn opcode(&self) -> Opcode { self.opcode -- cgit v1.1