Preprocessor: Added todo test case for better evaluation of #if conditions
This commit is contained in:
parent
dacaff824c
commit
f877cd2db1
|
@ -126,8 +126,16 @@ private:
|
|||
|
||||
static std::string getdef(std::string line, bool def);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Evaluate condition 'numerically'
|
||||
* @param cfg configuration
|
||||
* @param def condition
|
||||
* @return result when evaluating the condition
|
||||
*/
|
||||
static bool match_cfg_def(std::string cfg, std::string def);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Search includes from code and append code from the included
|
||||
* file
|
||||
|
|
|
@ -86,6 +86,9 @@ private:
|
|||
|
||||
TEST_CASE(elif);
|
||||
|
||||
// Test the Preprocessor::match_cfg_def
|
||||
TEST_CASE(match_cfg_def);
|
||||
|
||||
TEST_CASE(if_cond1);
|
||||
TEST_CASE(if_cond2);
|
||||
TEST_CASE(if_cond3);
|
||||
|
@ -518,6 +521,14 @@ private:
|
|||
|
||||
|
||||
|
||||
void match_cfg_def()
|
||||
{
|
||||
TODO_ASSERT_EQUALS(true, Preprocessor::match_cfg_def("A=1", "A==1"));
|
||||
TODO_ASSERT_EQUALS(true, Preprocessor::match_cfg_def("A=1", "A<2"));
|
||||
ASSERT_EQUALS(false, Preprocessor::match_cfg_def("A=1", "A==2"));
|
||||
ASSERT_EQUALS(false, Preprocessor::match_cfg_def("A=1", "A<1"));
|
||||
}
|
||||
|
||||
|
||||
void if_cond1()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue