From 7250bbe5ae2d2ee6b0334bc462aab73f7d8dac0e Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 20 Nov 2020 10:59:18 +0100 Subject: Assembler bugfixes - tests run successfully now --- tests/test-asm.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'tests/test-asm.cpp') diff --git a/tests/test-asm.cpp b/tests/test-asm.cpp index f4a1a2c..019f89c 100644 --- a/tests/test-asm.cpp +++ b/tests/test-asm.cpp @@ -178,22 +178,34 @@ TEST_F(AsmParseTest, parse_op_3) { } TEST_F(AsmParseTest, parse_op_4) { - std::vector> chunks4{parseAsm("add [edi], 3")}; + std::vector> chunks4{parseAsm("add [rdi], 3")}; ASSERT_EQ(chunks4.size(), 1); } +TEST_F(AsmParseTest, parse_op_4_error) { + ASSERT_THROW(parseAsm("add [edi], 3"), std::runtime_error); +} + TEST_F(AsmParseTest, parse_op_5) { - std::vector> chunks5{parseAsm("add byte ptr [edi], 3")}; + std::vector> chunks5{parseAsm("add byte ptr [rdi], 3")}; ASSERT_EQ(chunks5.size(), 1); } +TEST_F(AsmParseTest, parse_op_5_error) { + ASSERT_THROW(parseAsm("add byte ptr [edi], 3"), std::runtime_error); +} + TEST_F(AsmParseTest, parse_op_6) { - std::vector> chunks6{parseAsm("add dword ptr[edi], 3")}; + std::vector> chunks6{parseAsm("add dword ptr[rdi], 3")}; ASSERT_EQ(chunks6.size(), 1); } +TEST_F(AsmParseTest, parse_op_6_error) { + ASSERT_THROW(parseAsm("add dword ptr[al], 3"), std::runtime_error); +} + TEST_F(AsmParseTest, parse_op_7) { - std::vector> chunks7{parseAsm("add qword ptr[edi], 3")}; + std::vector> chunks7{parseAsm("add qword ptr[rdi], 3")}; ASSERT_EQ(chunks7.size(), 1); } -- cgit v1.2.3