Test Program Entry Point

Component Testing for Ada

Since ATTOL_TEST is a sub-unit and not a main unit, Component Testing for Ada generates a main procedure at the end of the test program with the name provided on the command line.

Two methods are available to start the execution of the test program:

  • Call during the elaboration of the unit under test.

  • Call by the main procedure.

Call During the Elaboration of the Unit

In this case, you must add an additional line in the body of the unit tested:

PACKAGE <name>

...

END;

PACKAGE BODY <name>

...

PROCEDURE ATTOL_TEST is SEPARATE;

BEGIN

...

ATTOL_TEST;

END;

The package specification is not modified, but the test procedure is called at every elaboration of the package. Therefore, you need to remove or replace this call with an empty procedure after the test phase.

Call by the Main Procedure

In this case, you must add an additional line in the specification of the unit tested:

PACKAGE < name>

...

PROCEDURE ATTOL_TEST;

...

END;

PACKAGE BODY <name> is

...

PROCEDURE ATTOL_TEST is SEPARATE;

END;

Component Testing will then automatically generate a call to the ATTOL_TEST procedure in the main procedure of the test program. The test will be executed during the execution of the main program.

Limitations

Consider the following limitations:

  • The unit under test must be of type package.

  • The root body of ATTOL_TEST (procedure ATTOL_TEST is separate) cannot appear inside a generic package.