summaryrefslogtreecommitdiffhomepage
path: root/test-asm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test-asm.cpp')
-rw-r--r--test-asm.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test-asm.cpp b/test-asm.cpp
index efdeab9..1d4634e 100644
--- a/test-asm.cpp
+++ b/test-asm.cpp
@@ -115,4 +115,18 @@ TEST_F(AsmTest, Intel64_multiple) {
0xE9, 0xFF, 0xFF, 0xFF, 0xFF, // jmp data1
0x01, 0x02, 0x03 // data
}));
+
+ segment.optimize();
+
+ ASSERT_EQ(segment.size(), 7);
+ ASSERT_EQ(segment.getCode(), std::vector<uint8_t>(
+ {
+ 0x90, // nop
+ 0xCD, 0x05, // int 5
+ 0xC3, // ret
+ // data1:
+ 0xC3, // ret
+ 0xEB, 0xFF, // jmp data1
+ 0x01, 0x02, 0x03 // data
+ }));
}