15.01.2017, 22:08
Hey,
So, i have made myself a little assert function:
It takes a string, a condition (function call) and the expected result.
I wanted to simplify that thing like this:
So, i have tried to use %0 as the condition parameter and the string parameter, which didn't work.
Here is what i already tried:
Does anyone have an idea on how to do this? if it even is possible
So, i have made myself a little assert function:
PHP код:
assertThat(title[], condition, expectedResult, bool:sendDefaultMessage = true)
{
if(condition == expectedResult)
{
return true;
}
if(sendDefaultMessage)
{
printf("%s: Expected: %d Result: %d", title, expectedResult, condition);
}
return false;
}
I wanted to simplify that thing like this:
PHP код:
#define ASSERT(%0,%1); assertThat(%0,%0,%1);
Here is what i already tried:
PHP код:
#define ASSERT(%0,%1); assertThat("%0",%0,%1); //prints %0
PHP код:
#define ASSERT(%0,%1); assertThat(#%0,%0,%1); //Gives mutliple errors
PHP код:
#define ASSERT(%0,%1); assertThat("" #%0,%0,%1); //Gives mutliple errors