print function call along with parameter value using C program

I want to print function call along with parameter values . Please let me know how can I do it .

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;
    }


Output :
main.c[30]:isEqual(left, right) return FALSE expected TRUE
test
main.c[31]:Testing("test") return FALSE expected FALSE

I want to print the above output like below. Please let me know how can I achieve that

Output :
main.c[30]:isEqual(left =10 , right=11) return FALSE expected TRUE
Last edited on
I fail to see even one bit of C++ in that code.
I need a logic in C or C++ programming code to achieve it
Topic archived. No new replies allowed.