© 2021 PikeTec All rights reserved
C and C++ code can be easily tested with TPT. Testing C or C++ code is possible for module and integration tests. Every piece of C/C++ code — small, big, or even integrated SW builds — can be tested with TPT. TPT masters your software tests and greatly simplifies creation, management, maintenance and analysis of tests.
By default, TPT supports lots of common C or C++ code features and even less frequently used ones. For special requests TPT is also flexible enough for manual tweaks. TPT masters your C and C++ tests — and you save time to focus on your product development.
TPT analyzes the structure of your C or C++ code automatically. It extracts all data types, variables and functions to get all the interface information of the system under test. TPT handles scalar variables, arrays, multidimensional arrays, structs, pointers, maps, curves and class instances. Even fix point scaling is easily managed by TPT so that the tester operates with natural physical values.
Function calls and function stubs are also supported and generated by TPT allowing the user to control their return values and arguments. The task scheduling with one or many C functions makes testing of your code very easy and flexible.
TPT automatically generates wrapper code that encapsules your code and connects it to TPT. If needed, TPT instruments your code either to access non-public variables or to track coverage conditions.
Tools such as MinGW, GCC or Visual Studio can be used to compile the executable.
You don’t have to care about all the details of test harness generation and test execution. It is as simple as pushing a button. TPT together with the generated test harness do all the work for you. TPT starts and controls the entire test execution.
You can even debug your C or C++ code during testing.
Complex C or C++ tests or test suites can be executed unattended in batch mode or by using the TPT Jenkins plugin, for example overnight. TPT can also remote control several execution instances in parallel which can significantly reduce test execution time.
After the test execution, TPT starts the test assessment based on the collected data for C or C++ variables and parameters. Also non-exported variables can been tracked by TPT and included in those assessments. Finally, a report of the results is generated.
In case your code is very special and needs your own setup to run TPT has the option to build your own flexible environment yourself.
You just need to compile and link an executable program with the TPT VM (TPT’s virtual machine library) connected to your SUT. The API of the TPT VM comes with convenient functions for initialization, variable bindings and cyclic interactions between the TPT VM and your SUT code for the whole test that usually runs over a certain time.
With this API you can build your own test setup while using the strength of TPT test modeling, test execution, test assessment, test reporting, and test process support.
The FUSION co-simulation environment of TPT allows interaction of one or more “simulation modules” — called FUSION nodes. Off-the-shelf, many FUSION nodes exist that allow interaction with 3rd party software and hardware components. For special needs, the public API of FUSION can by used by customers to connect additional FUSION nodes.
As an example, you can test C or C++ code (compiled as a FUSION node) together with plant models implemented in Simulink or with interfaces to other 3rd party software or hardware (e.g. CAN connectors).
Another great feature of TPT is the ability to test C or C++ code using an Eclipse CDT and GDB (GNU debugger) connector. Using TPT with Eclipse CDT and GDB allows to compile, test and debug C or C++ code. Remote control of the GNU Debugger makes debugging even easier and allows access to almost any variable in the code at runtime. The Eclipse CDT/GDB simulation can be controlled, observed and debugged directly and automatically via breakpoints and register accesses at runtime.
Testing based on requirements and maintaining traceability of requirements are invaluable components of efficient testing and test management. Download our White Paper on the subject, illustrated with the integration of TPT and codebeamer.