company logo

compact_code - Test code

Test code contains test scenarios for the function (unit tests), i.e. for all its implementations. Test code is used for generating test functions, especially for testing interface functions.

In order to generate a test program for C++ interface functions that might be called in TestBrowser, an executable has to be created within the same project with following properties:

  • name : test_classname
  • Export: on
  • Language: PL_C
  • EXE-Type: EXT_TestProgram

Selecting the executable in the ClassEditor tree and clicking on BuildExecutable or GenerateExecutableSource button in the function tool bar will generate (and compile) the test executable.

The code generation will include all implementations from class functions that have been marked as interface. Initial code for the test may be provided in the constructor implementation as test code. The first test code found for a constructor implementation is used as initialization code for the test.

Test programs are provided with a defined introduction code, which is defined in ODC_Project::GenerateTest() (ode.dev). This may be overloaded by providing a copy of this function in an external overload directory.