I am working on windows xp with RTRT 188.8.131.52.
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.
NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
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 110000JJAD814 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 110000JJAD814 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