Skip to content

Message printed when equality test failed is confusing in some case. #19

@telgniw

Description

@telgniw

Description

When the compared variable is changed within the equality test expression, such as EXPECT_EQ, the variable is changed for the second time when SkyPat is showing error message.

Code

In this case, the left-hand side is 11.

PAT_F(IntegerTest, eq_test)
{
  int a = 10;
  EXPECT_EQ(++a, 12);
}

Result

But the error shows 12 instead of 11.

[----------] 1 test from IntegerTest.
[ RUN      ] IntegerTest.eq_test
[  FAILED  ] 
IntegerTest.cpp:5: error: failed to expect
Value of: (++a == 12)
  Actual:   12
  Expected: 12

Expectation

  Actual:   11
  Expected: 12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions