MCPcopy Create free account
hub / github.com/MultiFuzz/MultiFuzz / check

Function check

hail-fuzz/src/load_resizer.rs:573–603  ·  view source on GitHub ↗
(pcode: pcode::Block, load_offset: usize, resize: Option<(u8, u8)>)

Source from the content-addressed store, hash-verified

571
572#[cfg(test)]
573fn check(pcode: pcode::Block, load_offset: usize, resize: Option<(u8, u8)>) {
574 use pcode::PcodeDisplay;
575
576 let sleigh = sleigh_runtime::SleighData::default();
577 for (i, entry) in pcode.instructions.iter().enumerate() {
578 eprintln!("[{i}] {}", entry.display(&sleigh));
579 }
580
581 let mut code = BlockTable::default();
582 code.blocks.push(icicle_vm::cpu::lifter::Block {
583 pcode,
584 entry: None,
585 start: 0x0,
586 end: 0x0,
587 context: 0x0,
588 exit: lifter::BlockExit::invalid(),
589 breakpoints: 0x0,
590 num_instructions: 0x1,
591 });
592
593 let mut cpu = Cpu::new_boxed(icicle_vm::cpu::Arch::none());
594 let mut resizer = LoadResizer::new(false);
595 let loads = resizer.get_loads(&mut cpu, &code, 0).unwrap();
596
597 if let Some((min_bit, max_bit)) = resize {
598 assert_eq!(&loads, &[(0, LoadMetadata { offset: load_offset, min_bit, max_bit })]);
599 }
600 else {
601 assert_eq!(&loads, &[]);
602 }
603}
604
605#[cfg(test)]
606fn check_multiblock(blocks: [pcode::Block; 3], load_offset: usize, resize: Option<(u8, u8)>) {

Callers 15

test_usedFunction · 0.85
test_unusedFunction · 0.85
test_low_bitsFunction · 0.85
test_lowest_bitFunction · 0.85
test_high_bitsFunction · 0.85
test_shift_and_sltFunction · 0.85
test_branchFunction · 0.85
test_branch_with_tmpsFunction · 0.85
with_right_shiftFunction · 0.85
with_left_shiftFunction · 0.85
with_bool_opFunction · 0.85
test_with_storeFunction · 0.85

Calls 1

get_loadsMethod · 0.80

Tested by 15

test_usedFunction · 0.68
test_unusedFunction · 0.68
test_low_bitsFunction · 0.68
test_lowest_bitFunction · 0.68
test_high_bitsFunction · 0.68
test_shift_and_sltFunction · 0.68
test_branchFunction · 0.68
test_branch_with_tmpsFunction · 0.68
with_right_shiftFunction · 0.68
with_left_shiftFunction · 0.68
with_bool_opFunction · 0.68
test_with_storeFunction · 0.68