CL 1: Code Verification
Credibility assessment level 1 contains multiple different tests for code quality. In the first test, linters are used to ensure general quality of code and documentation. In the example linked below, linters for C++ code, markdown files, and xml files such as SRMD and modelDescription are implemented. Further linters have to be added, if additional programming languages are used. In the second test, the model is build using cmake. The third test category runs unit tests defined for the individual model.
An implementation of the GitHub action for this credibility assessment level can be found in the sensor model template repository.
CL 1.1: Linter
These tests consist of linters checking the formatting against style guides for code, markdown and xml.
C++ Linter
C++ code is checked with clang according to the clang-format and clang-tidy files in the repository. It is mandatory for every code repository to provide these config files. As a best practice, clang-format-all can be used to automatically format all C++ files in the repository. Be aware, that formatting might break functionality, e.g. by a different order of includes. Be sure to check after formatting.
An implementation of the corresponding GitHub action can be found in the sensor model template repository.
Markdown Linter
Markdown files are checked by a markdown linter according to these basic rules.
An implementation of the corresponding GitHub action can be found in the sensor model template repository. It also contains an example markdownlint.json specifying variations of the applied rules.
SRMD Validator
Every model repository SHALL include an SRMD file conforming to the SSP tracability process. This file is checked against the SRMD XML schema.
CL 1.2: Build
These tests check if the model can be build and the built FMU is compliant with the FMI standard.
Cmake
This test checks if cmake runs without errors and the model can be built with all necessary dependencies, such as OSI with Protobuf.
An implementation of the corresponding GitHub action can be found in the sensor model template repository.
FMU Compliance Checker
The official FMU Compliance Checker by Modelica is used to check if the built FMU is compliant with the FMI standard. This includes checking the binaries as well as included xml files such as the modelDescription.
Since the FMU Compliance Checker does not seem to be further maintained, FMPy is used as a second validation tool.
CL 1.3 Unit Tests
Models SHALL include individual unit tests. The tests SHALL be located in a folder test/unit which MUST include the applied unit test library (e.g. GoogleTest). Unit tests have to be custom to the implementation of the individual model. Therefore, no standard unit tests are part of this test pipeline.
However, some examples can be found in the sensor model template repository.