Test your testing skills with RapiCover on Tetris
We were somewhat surprised and shocked to discover that Tetris turned 30 this year. As our own celebration of this classic game, we've added our own twist to it: you can now measure the structural code coverage as you play. There is a download link to this at the bottom of this blog post.
We've built a subset of RapiCover into a Tetris executable - "RapiTetris". This displays four different types of code coverage metrics, which are updated as you play:
- Function coverage. Has each function in the program been called?
- Statement coverage. Has each statement in the program been executed?
- Decision coverage. Has each branch of each decision been executed?
- Modified condition/decision coverage (MC/DC). Each condition should affect the decision outcome independently (An introduction to modified condition/decision coverage). This type of coverage is typically required for the most critical safety software (see for example DO-178B, DO-178C or ISO 26262 standards/guidelines for aerospace and automotive).
Attempting to get 100% coverage by playing the game alone will be extremely difficult (especially in the 30 minute time limit we've set). However, if you press
F4, it will generate a coverage report to show what code you've executed. The help text (press
F1) will give you some idea of how to interpret the RapiCover report.
Although this example serves to demonstrate some of RapiCover's capabilities, this isn't a typical use case:
- Firstly, code coverage is best used with requirements-based testing, rather than the coverage-driven testing approach that occurs here.
- Secondly, RapiCover's greatest strengths are found in on-target code coverage for embedded systems. Its low overheads and high flexibility make it ideal for this environment.
If you want to find out more about RapiCover's low overheads, you can request a trial version to try RapiCover in a (simulated) embedded environment.
Download RapiTetris here and see if you can get 100% coverage. If you find any particularly good test cases, please add them to the comments below.
White papers & webinars
Want to learn about common challenges and solutions in critical software verification? Our white papers and webinars may be just the thing:
- Multicore Timing Analysis for DO-178C
- Eight top code coverage questions in embedded avionics systems
- Seven Roadblocks to 100% structural coverage (and how to avoid them)
- Automating WCET Analysis for DO-178B & DO-178C
- Three steps to avoid software obsolescence in avionic systems
- CodeTEST® Replacement with RVS
- Multicore Timing Analysis for DO178 Projects Webinar