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

Introduce 'simplify expression' message? #37

Open
martinmoene opened this issue Aug 7, 2016 · 0 comments
Open

Introduce 'simplify expression' message? #37

martinmoene opened this issue Aug 7, 2016 · 0 comments

Comments

@martinmoene
Copy link
Owner

Given EXPECT( 1==9 || 1==8 ); doctest currently gives a false positive (see issue 30), whereas CATCH warns that the expression is 'too complicated' via a static assert.

lest currently gives a compile-time error that doesn't give a hint as to what the problem is:

Visual C++ 2015:

issue-exprdecomp-too-complex.cpp(7): error C2440: 'initializing': cannot convert from 'bool' to 'lest::result'
issue-exprdecomp-too-complex.cpp(7): note: No constructor could take the source type, or constructor overload resolution was ambiguous

GCC:

In file included from issue-expr-too-complex.cpp:1:0:
issue-expr-too-complex.cpp: In lambda function:
issue-expr-too-complex.cpp:7:22: error: conversion from 'bool' to non-scalar type 'lest::result' requested
         EXPECT( 1==9 || 1==8 );
                      ^
../../lest/include/lest/lest.hpp:216:67: note: in definition of macro 'lest_DECOMPOSE'
 #define lest_DECOMPOSE( expr ) ( lest::expression_decomposer() << expr )
                                                                   ^
../../lest/include/lest/lest.hpp:80:28: note: in expansion of macro 'lest_EXPECT'
 # define EXPECT            lest_EXPECT
                            ^
issue-expr-too-complex.cpp:7:9: note: in expansion of macro 'EXPECT'
         EXPECT( 1==9 || 1==8 );
         ^

Perhaps it's a good idea too warn too simplify the expression like CATCH does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant