Controller Tester provides several macros to help users write test code more easily. You can check and write the macro provided using the “[Ctrl] + [SPACEBAR]” shortcut in the editor view.

ASSERT macro

Examine the conditional expression and print the success/failure in the test case view.

Macro Parameter
CS_ASSERT(_b) _B: conditional expression
CS_ASSERT_MSG(_B, _msg) _b: conditional expression
_mgs: message to print when the conditional expression is false

Output macro

Print the values of specific variables in the test case view.

Macro Parameter
CS_INT_OUTPUT(_v, _s) _v: Integer variable
_s: test data name
CS_UINT_OUTPUT(_v, _s) _v: unsigned integer variable
_s: test data name
CS_FLT_OUTPUT(_v, _s) _v: real variable
_s: test data name
CS_STR_OUTPUT(_v, _s) _v: char* or char[] variable
_s: test data name

Input macro

Pass test data to the function under test.

Macro Parameter
CS_INT_INPUT(_t, _s) _t: integer type name
_s: test data name
CS_UINT_INPUT(_t, _s) _t: unsigned integer type name
_s: test data name
CS_FLT_INPUT(_t, _s) _t: real type name
_s: test data name
CS_STR_INPUT(_t, _s) _t: char* or char[] type name
_s: test data name

Address-related macros

If there is a part that directly assigns or fetches the value in the embedded address in the converted source code, it may not operate normally when executed on the local computer. In this case, you can use an address-related macro for the virtual address.

Macro Description
CS_VIRTUAL_ADDR(_b,_e) Creates the space from the address (_b) to the address (_e)
CS_ADDR_ASSIGN(_t,_a,_v)
CS_ADDR_SET(_t,_a,_v)
Assigns the value (_v) of type (_t) to the address (_a)
CS_ADDR_GET(_t,_a) Fetches the value of type (_t) from the address (_a)
CS_VIRTUAL_ADDR_CLEAR() Frees the memory space created

Address-related macro example

Other macros

Macro Parameter Description
CS_LOG(_msg) _msg: log message Outputs user log
CS_TESTCASENO() Returns the number of the test currently running

Need more help with this?
Don’t hesitate to contact us here.

Thanks for your feedback.