Your browser does not support JavaScript! Skip to main content
Free 30-day trial DO-178C Handbook RapiCoupling Preview DO-178C Multicore Training Multicore Resources
Rapita Systems
 

Industry leading verification tools & services

Rapita Verification Suite (RVS)

  RapiTest - Unit/system testing  RapiCover - Structural coverage analysis  RapiTime - Timing analysis (inc. WCET)  RapiTask - Scheduling visualization  RapiCoverZero - Zero footprint coverage analysis  RapiTimeZero - Zero footprint timing analysis  RapiTaskZero - Zero footprint scheduling analysis  RapiCouplingPreview - DCCC analysis

Multicore Verification

  MACH178  MACH178 Foundations  Multicore Timing Solution  RapiDaemons

Engineering Services

  V&V Services  Data Coupling & Control Coupling  Object code verification  Qualification  Training  Consultancy  Tool Integration  Support

Industries

  Civil Aviation (DO-178C)   Automotive (ISO 26262)   Military & Defense   Space

Other

RTBx Mx-Suite Software licensing Product life cycle policy RVS Assurance issue policy RVS development roadmap

Latest from Rapita HQ

Latest news

SAIF Autonomy to use RVS to verify their groundbreaking AI platform
RVS 3.22 Launched
Hybrid electric pioneers, Ascendance, join Rapita Systems Trailblazer Partnership Program
Magline joins Rapita Trailblazer Partnership Program to support DO-178 Certification
View News

Latest from the Rapita blog

How to certify multicore processors - what is everyone asking?
Data Coupling Basics in DO-178C
Control Coupling Basics in DO-178C
Components in Data Coupling and Control Coupling
View Blog

Latest discovery pages

control_tower DO-278A Guidance: Introduction to RTCA DO-278 approval
Picture of a car ISO 26262
DCCC Image Data Coupling & Control Coupling
Additional Coe verification thumb Verifying additional code for DO-178C
View Discovery pages

Upcoming events

DASC 2025
2025-09-14
DO-178C Multicore In-person Training (Fort Worth, TX)
2025-10-01
DO-178C Multicore In-person Training (Toulouse)
2025-11-04
HISC 2025
2025-11-13
View Events

Technical resources for industry professionals

Latest White papers

Mitigation of interference in multicore processors for A(M)C 20-193
Sysgo WP
Developing DO-178C and ED-12C-certifiable multicore software
DO178C Handbook
Efficient Verification Through the DO-178C Life Cycle
View White papers

Latest Videos

Rapita Systems - Safety Through Quality
Simulation for the Motorola 68020 microprocessor with Sim68020
AI-driven Requirements Traceability for Faster Testing and Certification
Multicore software verification with RVS 3.22
View Videos

Latest Case studies

GMV case study front cover
GMV verify ISO26262 automotive software with RVS
Kappa: Verifying Airborne Video Systems for Air-to-Air Refueling using RVS
Supporting DanLaw with unit testing and code coverage analysis for automotive software
View Case studies

Other Resources

 Webinars

 Brochures

 Product briefs

 Technical notes

 Research projects

 Multicore resources

Discover Rapita

Who we are

The company menu

  • About us
  • Customers
  • Distributors
  • Locations
  • Partners
  • Research projects
  • Contact us

US office

+1 248-957-9801
info@rapitasystems.com
Rapita Systems, Inc.
41131 Vincenti Ct.
Novi
MI 48375
USA

UK office

+44 (0)1904 413945
info@rapitasystems.com
Rapita Systems Ltd.
Atlas House
Osbaldwick Link Road
York, YO10 3JB
UK

Spain office

+34 93 351 02 05
info@rapitasystems.com
Rapita Systems S.L.
Parc UPC, Edificio K2M
c/ Jordi Girona, 1-3
Barcelona 08034
Spain

Working at Rapita

Careers

Careers menu

  • Current opportunities & application process
  • Working at Rapita
Back to Top Contact Us

Breadcrumb

  1. Home

Discover Code Coverage for Ada, C and C++

  • Intro
  • Testing code coverage
  • Types
  • Languages
  • Untested code
  • Code coverage webinar

What is code coverage?

Code coverage (also known as structural coverage) is a measurement of how much code is executed during testing and is a metric often used to assess the completeness of requirements-based testing. In requirements-based testing, which is encouraged when following certification guidelines or standards such as DO-178C (aerospace) or ISO 26262 (automotive), source code and associated tests are derived from high- and low-level requirements.

When performing requirements-based testing, every requirement may have one or more test cases verifying its correct implementation, and all source code should be traceable to a requirement. Measuring the code coverage achieved through testing can help demonstrate this requirement traceability.

Testing code coverage

Code coverage testing can help to ensure that all source code can be traced back to requirements. This can be demonstrated by showing that, when requirements-based tests are run, 100% code coverage is achieved through either testing (of testable code) or justification (of untestable code).

DO-178C and ISO 26262 recommend the use of code coverage analysis (also known as structural coverage analysis) for measuring the effectiveness of test cases on the road to certification.

The main benefits of testing code coverage are to show that:

  • Requirements are complete
  • Tests are complete i.e. there is a test for every requirement
  • No unnecessary code is deployed
  • Deactivated code (code that is only active in configurations different from the deployed configuration) is identified

While testing code coverage manually is possible, using an automated code coverage analysis tool such as RapiCover is much more efficient and can help avoid program delays.

code coverage for Ada
Code coverage for Ada analyzed using RapiCover – covered sections of code shown in green, uncovered sections of code shown in red

Types of Coverage

Different types of code coverage exist, which are used to consider code at varying levels of granularity. It is necessary to analyze code coverage at higher granularities when working with higher integrity software (e.g. higher DO-178C DAL Level or ISO 26262 ASIL).

From lowest to highest granularity, the main forms of code coverage are:

  • Function coverage – has every function (or Ada subprogram) in the code been called?
  • Statement coverage – has every statement been executed?
  • Branch/Decision coverage – have the true and false branches of every decision in the code been executed? This type of code coverage is called Branch coverage in ISO 26262 and Decision coverage in DO-178C.
  • Modified condition/decision coverage (MC/DC) – has each condition in every decision in the code been shown to independently affect the outcome of that decision? This is the most stringent code coverage metric and used with DO-178C DAL A software.

Analyzing code coverage for different languages

Whether your software is written in Ada, C or C++, code coverage is likely to be a crucial part of your software verification. If you choose to use an automated structural coverage analysis tool, you should ensure that it supports all of the languages you’re using. RapiCover supports code coverage for Ada, C, C++, and mixed language projects.

Depending on the language you’re using and coding standards you’re following, you may be unable to achieve 100% code coverage through testing alone and may need to supplement your test coverage by justifying your code as covered by analysis. Justifications may also be used for code that you’ve chosen not to test, for example because it’s more efficient to review the code structure manually.

An example of untestable code arising due to following a coding standard is that your standard could require you to include default clauses in C switch statements or when others clauses in Ada case statements.

In such a situation, you may have untestable code if all of the cases in the code include the full range of possible values.

case x is
                          when 0 => Ada.Text_IO.Put ("zero");
                          when 1 => Ada.Text_IO.Put ("one");
                          when 2 => Ada.Text_IO.Put ("two");
                          when others => Ada.Text_IO.Put ("none of the above");
                          end case;
                          
An Ada when others clause may be untestable and may need to be justified as covered by analysis. In the code above, if the type of x is constrained to the range 0-2, the when others statement would be untestable. However, you may need to include such a clause because of your coding standards.

Handling untested code

Whether untested code is untestable or you’ve simply chosen not to test it, it can either be justified manually or by using an automated code coverage analysis tool.

Manually justifying untested code would be a painstaking process, especially in larger projects. If any changes were made to code that was justified manually, considerable review effort would be needed to ensure that any justifications are applied are still valid.

Automated code coverage analysis tools that let you justify your untested code and migrate justifications such as RapiCover mitigate the cost of justifying untested code.

When your code changes, RapiCover can analyze the impact of changes on justifications and often identify the new location of justified code that has changed, even when it has moved to a different line in the source file. This can save a huge amount of review effort.

RapiCover helps migrate justifications
RapiCover helps migrate justifications for untested code when code changes by identifying the new location of justified code
RapiCover

Low-overhead coverage analysis for critical software

 
Choose your free resource:
When you contact us, we will process your personal data in accordance with our data protection policy, please see our Customer Privacy Information for more information.
  • Solutions
    • Rapita Verification Suite
    • RapiTest
    • RapiCover
    • RapiTime
    • RapiTask
    • MACH178

    • Verification and Validation Services
    • Qualification
    • Training
    • Integration
  • Latest
  • Latest menu

    • News
    • Blog
    • Events
    • Videos
  • Downloads
  • Downloads menu

    • Brochures
    • Webinars
    • White Papers
    • Case Studies
    • Product briefs
    • Technical notes
    • Software licensing
  • Company
  • Company menu

    • About Rapita
    • Careers
    • Customers
    • Distributors
    • Industries
    • Locations
    • Partners
    • Research projects
    • Contact
  • Discover
    • Multicore Timing Analysis
    • Embedded Software Testing Tools
    • Worst Case Execution Time
    • WCET Tools
    • Code coverage for Ada, C & C++
    • MC/DC Coverage
    • Verifying additional code for DO-178C
    • Timing analysis (WCET) & Code coverage for MATLAB® Simulink®
    • Data Coupling & Control Coupling
    • Aerospace Software Testing
    • Automotive Software Testing
    • Certifying eVTOL
    • DO-178C
    • AC 20-193 and AMC 20-193
    • ISO 26262
    • What is CAST-32A?

All materials © Rapita Systems Ltd. 2025 - All rights reserved | Privacy information | Trademark notice Subscribe to our newsletter