MCPcopy Index your code
hub / github.com/encounter/objdiff / test_scan_instructions

Function test_scan_instructions

objdiff-core/src/arch/x86.rs:556–573  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

554
555 #[test]
556 fn test_scan_instructions() {
557 let arch = ArchX86 { arch: Architecture::X86, endianness: object::Endianness::Little };
558 let code = [
559 0xc7, 0x85, 0x68, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x8b, 0x04, 0x85, 0x00,
560 0x00, 0x00, 0x00,
561 ];
562 let scanned =
563 arch.scan_instructions_internal(0, &code, 0, &[], &DiffObjConfig::default()).unwrap();
564 assert_eq!(scanned.len(), 2);
565 assert_eq!(scanned[0].address, 0);
566 assert_eq!(scanned[0].size, 10);
567 assert_eq!(scanned[0].opcode, iced_x86::Mnemonic::Mov as u16);
568 assert_eq!(scanned[0].branch_dest, None);
569 assert_eq!(scanned[1].address, 10);
570 assert_eq!(scanned[1].size, 7);
571 assert_eq!(scanned[1].opcode, iced_x86::Mnemonic::Mov as u16);
572 assert_eq!(scanned[1].branch_dest, None);
573 }
574
575 #[test]
576 fn test_process_instruction() {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected