[Lldb-commits] [lldb] r282683 - Add a unit test for an x86_64 assembly inspection of

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 28 21:28:27 PDT 2016


On Wed, Sep 28, 2016 at 9:10 PM Jason Molenda via lldb-commits <
lldb-commits at lists.llvm.org> wrote:

>
> +  EXPECT_TRUE(regloc.GetOffset() == -8);
>
This should be

EXPECT_EQ(-8, regloc.GetOffset());

That way if it fails, you'll get a handy error message that says:

Expected: -8
Actual: -7

If you use EXPECT_TRUE, it's not going to tell you the actual value.  The
same goes for many other places in the file.  Note that you're supposed to
put the expected value *first*.  The test is the same either way obviously,
but it affects the printing of the above message.


> +
> +  // these could be set to IsSame and be valid -- meaning that the
> +  // register value is the same as the caller's -- but I'd rather
> +  // they not be mentioned at all.
> +  EXPECT_TRUE(row_sp->GetRegisterInfo(k_rbp, regloc) == false);
> +  EXPECT_TRUE(row_sp->GetRegisterInfo(k_r15, regloc) == false);
> +  EXPECT_TRUE(row_sp->GetRegisterInfo(k_r14, regloc) == false);
> +  EXPECT_TRUE(row_sp->GetRegisterInfo(k_r13, regloc) == false);
> +  EXPECT_TRUE(row_sp->GetRegisterInfo(k_r12, regloc) == false);
> +  EXPECT_TRUE(row_sp->GetRegisterInfo(k_rbx, regloc) == false);
>
If you're using EXPECT_TRUE and EXPECT_FALSE, I think it's more intuitive
to not use the comparison operator.  The above is just

EXPECT_FALSE(row_sp->GetRegisterInfo(k_rbx, regloc));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160929/059f5ef8/attachment.html>


More information about the lldb-commits mailing list