Preprocessor: Added todo test case for better evaluation of #if conditions

This commit is contained in:
Daniel Marjamäki 2009-07-25 16:22:42 +02:00
parent dacaff824c
commit f877cd2db1
2 changed files with 19 additions and 0 deletions

View File

@ -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

View 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()
{