I am working on windows xp with RTRT 220.127.116.11.
i have a code like this: "#define CLAMP() (0u)" in my *.h file which is called from source file.
And I need the control to modify the macro function CLAMP()used in my code to do testing of a specific functionality.
I tried using undef define ifdef ifndef but no luck. I cant modify the code hence i have to control this macro function from the ptu. And i want a variable to control this macro function so that i can use it in different test cases body.
If somebody can provide some solution for the same it will be of great help.
thanks in advance.
This topic has been locked.
5 replies Latest Post - 2013-01-24T07:45:33Z by SystemAdmin
Pinned topic Control Macro function in my Test case
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-01-24T07:45:33Z at 2013-01-24T07:45:33Z by SystemAdmin
richard.france 110000JJAD811 PostsACCEPTED ANSWER
Re: Control Macro function in my Test case2012-12-06T07:55:09Z in response to SystemAdminTestRT unit test is a C code generator.
If you cannot do it using C code that means you cannot do it using TestRT.
I assume the header file (.h) is included by the source code (.c)
you have a solution only If your header file is protected against multiple inclusion like
If not then try to see if you can made the modification because this is a standard coding rule to protect header file like this.
Re: Control Macro function in my Test case2012-12-18T09:14:08Z in response to SystemAdminThanks for your help.
i have tried one more solution for my problem n its working fine for my project.
I used the below command in my ptu
##include "D:\PU_1_RTRT\SW\abc.h" /* Original header file*/
##undef CLAMP /* Undefining Macro function*/
#uint8 value; /* User defined new variable*/
#define CLAMP() value /* Defining new value*/
##include "D:\ PU_1_RTRT\SW\abc.c" /* Original Source file*/
Let me know if we can do the same in some other way.
Thanks again Richard.
richard.france 110000JJAD811 Posts
Re: Control Macro function in my Test case2013-01-24T07:45:33Z in response to richard.franceyes,in my code,the header was protected against multiple inclusion,then i did like
##define xxxx aaa