...
Entry point macros control the testing entry point. By default, main() is called. However, sometimes the tests can only be called from a different point in the program you are testing, or need to be called in a special manner. You can control this using the following macros:
Name | Description |
---|---|
CPPTEST_EPT_main | If defined, the 'int main(int, char*[])' is used as an entry point. |
CPPTEST_EPT_wmain | If defined, the 'int wmain(int, wchar_t*[])' is used as an entry point. |
CPPTEST_EPT_WinMain | If defined, the 'int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPSTR, int)' is used as an entry point. |
CPPTEST_EPT_WinMain | If defined, the 'int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPWSTR, int)' is used as an entry point. |
CPPTEST_EPT_void_main | If defined, the 'void main(int, char*[])' is used as an entry point. |
CPPTEST_EPT_main_no_args | If defined, the 'int main(void)' is used as an entry point. |
CPPTEST_EPT_void_main_no_args | If defined, the 'void main(void)' is used as an entry point. |
CPPTEST_ENTRY_POINT_C_LINKAGE | If defined, the main function declaration starts with 'extern "C"' if compiled as c++ code. |
You can also define the CPPTEST_ENTRY_POINT macro. If this macro will be defined, the generated main function will look like this:
...
CPPTEST_ENTRY_POINT_RETURN_TYPE, CPPTEST_ENTRY_POINT_ARGS, CPPTEST_ENTRY_POINT_ARGC, CPPTEST_ENTRY_POINT_ARGV and CPPTEST_ENTRY_POINT_RETURN_STATEMENT have the following default values that can be redefined:
Name | Value |
---|---|
CPPTEST_ENTRY_POINT_RETURN_TYPE | int |
CPPTEST_ENTRY_POINT_ARGS | void |
CPPTEST_ENTRY_POINT_ARGC | 0 |
CPPTEST_ENTRY_POINT_ARGV | 0 |
CPPTEST_ENTRY_POINT_RETURN_STATEMENT | return 0; |
You can also define the CPPTEST_ENTRY_POINT_DEFINED macro. Defining this macro prevents the main routine from generating. In these cases, you need to call a CppTest_Main(0, 0)
function to execute the test cases.
...