1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#include <stdio.h>
typedef int BOOL;
#define FALSE 0
#define TRUE 1
#define CALL_FUN(_command, _expResult) CallFunction(__FILE__, __LINE__, #_command, _command, _expResult)
BOOL CallFunction(const char* pFile, int lineNr, const char* pCommand, BOOL retVal, BOOL expResult)
{
printf("%s[%d]:%s return %s expected %s \n",pFile, lineNr, pCommand,
retVal?"TRUE":"FALSE", expResult?"TRUE":"FALSE");
return retVal;
}
BOOL Testing(const char * pStr)
{
printf("%s\n", pStr);
return FALSE;
}
BOOL isEqual(int i, int j)
{
return i == j;
}
int main(void)
{
int left = 10;
int right = 11;
CALL_FUN(isEqual(left, right),TRUE);
CALL_FUN(Testing("test"), FALSE);
// CALL_FUN(Testing("testing parm"),TRUE);
return 0;
}
|