diff options
Diffstat (limited to 'tests/test-asm.cpp')
-rw-r--r-- | tests/test-asm.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/tests/test-asm.cpp b/tests/test-asm.cpp index 019f89c..650a48a 100644 --- a/tests/test-asm.cpp +++ b/tests/test-asm.cpp @@ -57,7 +57,7 @@ TEST_F(AsmTest, Intel64_add) { Asm::Args args{{Asm::Args::Register32("eax"), Asm::Args::Immediate32(1)}}; segment.push_back(makeOp("add", args)); - ASSERT_EQ(segment.size(), 1); + ASSERT_EQ(segment.size(), size_t(1)); ASSERT_EQ(segment.getCode(), std::vector<uint8_t>({0x05, 0x01, 0x00, 0x00, 0x00})); } @@ -66,7 +66,7 @@ TEST_F(AsmTest, Intel64_int_0) { Asm::Args args{{Asm::Args::Immediate8(0)}}; segment.push_back(makeOp("int", args)); - ASSERT_EQ(segment.size(), 1); + ASSERT_EQ(segment.size(), size_t(1)); ASSERT_EQ(segment.getCode(), std::vector<uint8_t>{0xCE}); } @@ -75,7 +75,7 @@ TEST_F(AsmTest, Intel64_int_1) { Asm::Args args{{Asm::Args::Immediate8(1)}}; segment.push_back(makeOp("int", args)); - ASSERT_EQ(segment.size(), 1); + ASSERT_EQ(segment.size(), size_t(1)); ASSERT_EQ(segment.getCode(), std::vector<uint8_t>{0xF1}); } @@ -84,7 +84,7 @@ TEST_F(AsmTest, Intel64_int_5) { Asm::Args args{{Asm::Args::Immediate8(5)}}; segment.push_back(makeOp("int", args)); - ASSERT_EQ(segment.size(), 1); + ASSERT_EQ(segment.size(), size_t(1)); ASSERT_EQ(segment.getCode(), std::vector<uint8_t>({0xCD, 0x05})); } @@ -92,7 +92,7 @@ TEST_F(AsmTest, Intel64_nop) { Segment segment; segment.push_back(makeOp("nop")); - ASSERT_EQ(segment.size(), 1); + ASSERT_EQ(segment.size(), size_t(1)); ASSERT_EQ(segment.getCode(), std::vector<uint8_t>{0x90}); } @@ -100,7 +100,7 @@ TEST_F(AsmTest, Intel64_ret) { Segment segment; segment.push_back(makeOp("ret")); - ASSERT_EQ(segment.size(), 1); + ASSERT_EQ(segment.size(), size_t(1)); ASSERT_EQ(segment.getCode(), std::vector<uint8_t>{0xC3}); } @@ -119,7 +119,7 @@ TEST_F(AsmTest, Intel64_multiple) { segment.insertAddresses(); - ASSERT_EQ(segment.size(), 7); + ASSERT_EQ(segment.size(), size_t(7)); ASSERT_EQ(segment.getCode(), std::vector<uint8_t>( { 0x90, // nop @@ -133,7 +133,7 @@ TEST_F(AsmTest, Intel64_multiple) { segment.optimize(); - ASSERT_EQ(segment.size(), 7); + ASSERT_EQ(segment.size(), size_t(7)); ASSERT_EQ(segment.getCode(), std::vector<uint8_t>( { 0x90, // nop @@ -148,38 +148,38 @@ TEST_F(AsmTest, Intel64_multiple) { TEST_F(AsmParseTest, parse_empty) { std::vector<std::shared_ptr<Chunk>> chunks0{parseAsm("")}; - ASSERT_EQ(chunks0.size(), 0); + ASSERT_EQ(chunks0.size(), 0u); std::vector<std::shared_ptr<Chunk>> chunks1{parseAsm("\n\n")}; - ASSERT_EQ(chunks1.size(), 0); + ASSERT_EQ(chunks1.size(), 0u); std::vector<std::shared_ptr<Chunk>> chunks2{parseAsm("\n\n")}; - ASSERT_EQ(chunks2.size(), 0); + ASSERT_EQ(chunks2.size(), 0u); } TEST_F(AsmParseTest, parse_op_0) { std::vector<std::shared_ptr<Chunk>> chunks0{parseAsm("nop")}; - ASSERT_EQ(chunks0.size(), 1); + ASSERT_EQ(chunks0.size(), 1u); } TEST_F(AsmParseTest, parse_op_1) { std::vector<std::shared_ptr<Chunk>> chunks1{parseAsm("neg edi")}; - ASSERT_EQ(chunks1.size(), 1); + ASSERT_EQ(chunks1.size(), 1u); } TEST_F(AsmParseTest, parse_op_2) { std::vector<std::shared_ptr<Chunk>> chunks2{parseAsm("add eax, edx")}; - ASSERT_EQ(chunks2.size(), 1); + ASSERT_EQ(chunks2.size(), 1u); } TEST_F(AsmParseTest, parse_op_3) { std::vector<std::shared_ptr<Chunk>> chunks3{parseAsm("add eax, 3")}; - ASSERT_EQ(chunks3.size(), 1); + ASSERT_EQ(chunks3.size(), 1u); } TEST_F(AsmParseTest, parse_op_4) { std::vector<std::shared_ptr<Chunk>> chunks4{parseAsm("add [rdi], 3")}; - ASSERT_EQ(chunks4.size(), 1); + ASSERT_EQ(chunks4.size(), 1u); } TEST_F(AsmParseTest, parse_op_4_error) { @@ -188,7 +188,7 @@ TEST_F(AsmParseTest, parse_op_4_error) { TEST_F(AsmParseTest, parse_op_5) { std::vector<std::shared_ptr<Chunk>> chunks5{parseAsm("add byte ptr [rdi], 3")}; - ASSERT_EQ(chunks5.size(), 1); + ASSERT_EQ(chunks5.size(), 1u); } TEST_F(AsmParseTest, parse_op_5_error) { @@ -197,7 +197,7 @@ TEST_F(AsmParseTest, parse_op_5_error) { TEST_F(AsmParseTest, parse_op_6) { std::vector<std::shared_ptr<Chunk>> chunks6{parseAsm("add dword ptr[rdi], 3")}; - ASSERT_EQ(chunks6.size(), 1); + ASSERT_EQ(chunks6.size(), 1u); } TEST_F(AsmParseTest, parse_op_6_error) { @@ -206,46 +206,46 @@ TEST_F(AsmParseTest, parse_op_6_error) { TEST_F(AsmParseTest, parse_op_7) { std::vector<std::shared_ptr<Chunk>> chunks7{parseAsm("add qword ptr[rdi], 3")}; - ASSERT_EQ(chunks7.size(), 1); + ASSERT_EQ(chunks7.size(), 1u); } TEST_F(AsmParseTest, parse_label) { std::vector<std::shared_ptr<Chunk>> chunks0{parseAsm("label1:")}; - ASSERT_EQ(chunks0.size(), 1); + ASSERT_EQ(chunks0.size(), 1u); std::vector<std::shared_ptr<Chunk>> chunks1{parseAsm("label2: add eax, 3")}; - ASSERT_EQ(chunks1.size(), 2); + ASSERT_EQ(chunks1.size(), 2u); } TEST_F(AsmParseTest, parse_multiline) { std::vector<std::shared_ptr<Chunk>> chunks1{parseAsm("add eax, 3\n")}; - ASSERT_EQ(chunks1.size(), 1); + ASSERT_EQ(chunks1.size(), 1u); std::vector<std::shared_ptr<Chunk>> chunks2{parseAsm("label2: add eax, 3\n mul rdx")}; - ASSERT_EQ(chunks2.size(), 3); + ASSERT_EQ(chunks2.size(), 3u); std::vector<std::shared_ptr<Chunk>> chunks3{parseAsm("label2: add eax, 3\n mul rdx\n")}; - ASSERT_EQ(chunks3.size(), 3); + ASSERT_EQ(chunks3.size(), 3u); std::vector<std::shared_ptr<Chunk>> chunks4{parseAsm("label2: add eax, 3\n\n\n mul rdx")}; - ASSERT_EQ(chunks4.size(), 3); + ASSERT_EQ(chunks4.size(), 3u); } TEST_F(AsmParseTest, parse_comment) { std::vector<std::shared_ptr<Chunk>> chunks0{parseAsm(" ; Comment 1")}; - ASSERT_EQ(chunks0.size(), 0); + ASSERT_EQ(chunks0.size(), 0u); std::vector<std::shared_ptr<Chunk>> chunks1{parseAsm("label2: add eax, 3 ; A comment")}; - ASSERT_EQ(chunks1.size(), 2); + ASSERT_EQ(chunks1.size(), 2u); std::vector<std::shared_ptr<Chunk>> chunks3{parseAsm("label2: add eax, 3 // Another comment")}; - ASSERT_EQ(chunks3.size(), 2); + ASSERT_EQ(chunks3.size(), 2u); std::vector<std::shared_ptr<Chunk>> chunks4{parseAsm("label2: add eax, 3 // Another comment\nadd rax, rdi")}; - ASSERT_EQ(chunks4.size(), 3); + ASSERT_EQ(chunks4.size(), 3u); std::vector<std::shared_ptr<Chunk>> chunks5{parseAsm("label2: add eax, 3 // Another comment\n \t add rax, rdi")}; - ASSERT_EQ(chunks5.size(), 3); + ASSERT_EQ(chunks5.size(), 3u); } TEST_F(AsmParseTest, parse_error) { |