Skip to content

Commit 046afcf

Browse files
committed
refactor(test_helpers): De-duplicate linker method
1 parent 076c144 commit 046afcf

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

tasm-lib/src/test_helpers.rs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ pub fn link_and_run_tasm_for_test<T: RustShadow>(
454454
nondeterminism: NonDeterminism,
455455
maybe_sponge: Option<VmHasher>,
456456
) -> VMState {
457-
let code = link_for_isolated_run(snippet_struct);
457+
let code = snippet_struct.inner().borrow().link_for_isolated_run();
458458

459459
execute_test(
460460
&code,
@@ -466,25 +466,6 @@ pub fn link_and_run_tasm_for_test<T: RustShadow>(
466466
)
467467
}
468468

469-
fn link_for_isolated_run<T: RustShadow>(snippet_struct: &T) -> Vec<LabelledInstruction> {
470-
let mut library = Library::new();
471-
let entrypoint = snippet_struct.inner().borrow().entrypoint();
472-
let function_body = snippet_struct.inner().borrow().annotated_code(&mut library);
473-
let library_code = library.all_imports();
474-
475-
// The TASM code is always run through a function call, so the 1st instruction is a call to the
476-
// function in question.
477-
let code = triton_asm!(
478-
call {entrypoint}
479-
halt
480-
481-
{&function_body}
482-
{&library_code}
483-
);
484-
485-
code
486-
}
487-
488469
pub fn test_rust_equivalence_given_execution_state<S: RustShadow>(
489470
snippet_struct: &S,
490471
execution_state: InitVmState,

0 commit comments

Comments
 (0)