Skip to main content

Test of a constant defined in a header file


Technote (FAQ)


Question

How can you test a constant using IBM Rational Test RealTime?

Cause

You need to test a constant, when a header has a constant that points to a memory address.


EXAMPLE


Disclaimer

All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.




The header.h file contains the following line.



#define MEMORY_ADDRESS=0x80a800


Answer


1. Add -D (define) to the new value Within the project setting Preprocessor flags.



-D MEMORY_ADDRESS=0x40b620











2. Add a t the beginning of the Test Script (.ptu) the following's lines.


##include "header.h"
##undef MEMORY_ADDRESS
##include "header.h"




REMARK

This solution is possible only if you protect the header file. This means you code a #ifdef to avoid a double inclusion.


Rate this page:

(0 users)Average rating

Copyright and trademark information

IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.

Rate this page:


(0 users)Average rating

Add comments

Document information

Rational Test RealTime

Component Testing: C


Software version:
7.5, 7.5.0.1, 7.5.0.2, 7.5.0.3, 7.5.0.4, 7.5.0.5, 7.5.0.6, 8.0, 8.0.0.1


Operating system(s):
Windows


Reference #:
1611671


Modified date:
2012-11-16

Translate my page

Content navigation