Skip to content
jvf edited this page Jun 15, 2013 · 24 revisions

Testing

Test Coverage in Moduls

The fuc group decided a goal of 90% test coverage for the project.

Integration Tests

Integration tests are tests which test the whole compiler chain: Lexer -> Parser -> Semantic Analyser -> IR Generator -> LLVM Backend.

The integration tests can be found in fuc/code/test. In order to be able to use the example programes in different test classes, they are centralized in ExampleProgs.java. The example programs comprise of the examples from common/examples (loaded from there) plus some additional tests. TestBase.java provides the base class for all integration tests.

There are two kinds of integration tests:

  1. Compilation Tests

  2. Runtime Tests

Compilation Tests

The compilation tests test if the example program compiles through all stages of the compiler, producing some kind of LLVM IR Code in the end. These tests only test if the compiler runs through without producing errors, not for the correctness of the resulting LLVM IR Code.

If the example programs are erroneous, they are testet for producing the expected error messages.

The compilation tests are included in the default run-tests ant target (and thereby also included in the travis CI).

Runtime Tests

The runtime tests compile the example programs and executes the resulting LLVM IR Code with lli. The results of the execution are then checked for the correct output (print statements) and exit code (return statement). The runtime tests hereby provide limited correctness testing (no proof of correctness of course!).

Clone this wiki locally