-
-
Notifications
You must be signed in to change notification settings - Fork 648
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
False positive test #30
Comments
This is planned to be fixed (the way Catch does it) in 1.1 - I will also limit the expression decomposition to only binary expressions the same way. Unfortunately the release of 1.1 was delayed but it will come. Thanks for the report! I think that in this particular case |
That's great news! This is happening because of the way ExpressionDecomposer() works, right? I do not think that
as
Taking operator precedence, operator << it's the first to evaluate, producing an instance of Expression_lhs.
As Result has a bool conversion operator that, in this case, gets evaluated to true, the whole expression is evaluated to true. I see that this line
is commented out in the Result class. I imagine that in version 1.1 you are going to take out the comment and then the same result that in Catch will be obtained. Ok, thank you for your great library. |
actually you are right :D |
I forgot this issue and I logged another one for the same thing. It should be done in the dev branch - only the reasonable expressions will be allowed and for anything else a static assert with a message will be used. Version 1.1 incoming in the next few days! |
This simple program:
Compiled with g++ 5.4.0 or clang++ 3.8.0 generates a program that, when executed, shows:
But obviously "1==9 || 1==8" is false.
(A similar program with Catch produces an error saying "STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison")
I don't known if this is a known limitation, but it is a disturbing one.
The text was updated successfully, but these errors were encountered: