-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Labels
A-assemblerArea: assemblerArea: assemblerC-bugCategory: this is a bug, deviation, or other problemCategory: this is a bug, deviation, or other problemE-mediumExperience: of moderate difficultyExperience: of moderate difficulty
Description
I think these two test cases (in etk-asm/src/asm.rs) should pass:
#[test]
fn assemble_instruction_macro_two_delayed_definitions_mirrored() -> Result<(), Error> {
let ops = vec![
AbstractOp::new(GetPc),
AbstractOp::Macro(InstructionMacroInvocation {
name: "macro1".into(),
parameters: vec![],
}),
AbstractOp::Macro(InstructionMacroInvocation {
name: "macro0".into(),
parameters: vec![],
}),
InstructionMacroDefinition {
name: "macro0".into(),
parameters: vec![],
contents: vec![
AbstractOp::new(JumpDest),
],
}
.into(),
InstructionMacroDefinition {
name: "macro1".into(),
parameters: vec![],
contents: vec![
AbstractOp::new(Caller),
],
}
.into(),
];
let mut asm = Assembler::new();
let sz = asm.push_all(ops)?;
assert_eq!(sz, 3);
let out = asm.take();
assert_eq!(out, hex!("58335b"));
Ok(())
} #[test]
fn assemble_instruction_macro_two_delayed_definitions() -> Result<(), Error> {
let ops = vec![
AbstractOp::new(GetPc),
AbstractOp::Macro(InstructionMacroInvocation {
name: "macro0".into(),
parameters: vec![],
}),
AbstractOp::Macro(InstructionMacroInvocation {
name: "macro1".into(),
parameters: vec![],
}),
InstructionMacroDefinition {
name: "macro0".into(),
parameters: vec![],
contents: vec![
AbstractOp::new(JumpDest),
],
}
.into(),
InstructionMacroDefinition {
name: "macro1".into(),
parameters: vec![],
contents: vec![
AbstractOp::new(Caller),
],
}
.into(),
];
let mut asm = Assembler::new();
let sz = asm.push_all(ops)?;
assert_eq!(sz, 3);
let out = asm.take();
assert_eq!(out, hex!("585b33"));
Ok(())
}Metadata
Metadata
Assignees
Labels
A-assemblerArea: assemblerArea: assemblerC-bugCategory: this is a bug, deviation, or other problemCategory: this is a bug, deviation, or other problemE-mediumExperience: of moderate difficultyExperience: of moderate difficulty