Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print string for comparison operands only once when it is same for both #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kuzkry
Copy link
Owner

@kuzkry kuzkry commented Dec 28, 2020

This PR is based on #2.

When both operands of a failed comparison get the very same string representation from FormatForComparisonFailureMessage, it is not necessary to print it twice. For example:

auto x = std::numeric_limits<int64_t>::lowest();
auto y = std::numeric_limits<int64_t>::min();
ASSERT_NE(x, y);

Output before this commit:

Expected: (x) != (y), actual: -9223372036854775808 vs -9223372036854775808

Output after this commit:

Expected: (x) != (y), actual: -9223372036854775808 (same for both operands)

When both operands of a failed comparison get the very same string representation from `FormatForComparisonFailureMessage`, it is not necessary to print it twice. For example:

    auto x = std::numeric_limits<int64_t>::lowest();
    auto y = std::numeric_limits<int64_t>::min();
    ASSERT_NE(x, y);

Output before this commit:

> Expected: (x) != (y), actual: -9223372036854775808 vs -9223372036854775808

Output after this commit:

> Expected: (x) != (y), actual: -9223372036854775808 (same for both operands)
@kuzkry kuzkry force-pushed the Do-not-print-same-string-twice branch from c3b3153 to eeca213 Compare December 28, 2020 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants