diff --git a/codegen/src/jump/mod.rs b/codegen/src/jump/mod.rs index b22a8f470..718bfb23e 100644 --- a/codegen/src/jump/mod.rs +++ b/codegen/src/jump/mod.rs @@ -175,17 +175,17 @@ mod tests { table.relocate(&mut buffer)?; // Check first jump (should use PUSH2) + assert_eq!(buffer[0x10], 0x61); // PUSH2 assert_eq!(buffer[0x11], 0x01); // First byte assert_eq!(buffer[0x12], 0x3c); // Second byte assert_eq!(0x013c, 0x100 + 20 * 3); // Check last jump (should still use PUSH2 but with adjusted offset) let last_idx = 0x10 + 19 + 19 * 3; + assert_eq!(buffer[last_idx], 0x61); // PUSH2 assert_eq!(buffer[last_idx + 1], 0x03); // First byte should be larger assert_eq!(buffer[last_idx + 2], 0x9c); // Second byte accounts for all previous jumps - - // FIXME: This is wrong, we need to add the offsets of all previous jumps - // assert_eq!(0x039c, 0x100 + 20 * 19 + 20 * 3); + assert_eq!(0x039c, 0x100 + 0x20 * 19 + 20 * 3); Ok(()) }