NPATH is a metric introduced by Brian A. Nejmeh (Communications of the ACM, 31(2):188–200, 1988) that is aimed at overcoming some important limitations of McCabe's cyclomatic complexity metric. Despite the fact that the declared NPATH objective is to count the number of acyclic execution paths through a function, the definition given for the C language in Nejmeh's paper fails to do so even for very simple programs. We show that counting the number of acyclic paths in CFG is unfeasible in general. Then we define a new metric for C-like languages, called ACPATH, that allows to quickly compute a very good estimation of the number of acyclic execution paths through the given function. We show that, if the function body does not contain backward gotos and does not contain jumps into a loop from outside the loop (which is the case for all MISRA-compliant programs), then such estimation is actually exact.
The ACPATH Structural Complexity Metric / Bagnara, Roberto; Bagnara, Abramo; Benedetti, Alessandro; Hill, Patricia M.. - ELETTRONICO. - (2024), pp. 127-138. (Intervento presentato al convegno IEEE 24th International Conference on Software Quality, Reliability and Security (QRS 2024) tenutosi a Cambridge, UK nel July 1-5, 2024) [10.1109/QRS62785.2024.00022].
The ACPATH Structural Complexity Metric
Roberto Bagnara
;
2024-01-01
Abstract
NPATH is a metric introduced by Brian A. Nejmeh (Communications of the ACM, 31(2):188–200, 1988) that is aimed at overcoming some important limitations of McCabe's cyclomatic complexity metric. Despite the fact that the declared NPATH objective is to count the number of acyclic execution paths through a function, the definition given for the C language in Nejmeh's paper fails to do so even for very simple programs. We show that counting the number of acyclic paths in CFG is unfeasible in general. Then we define a new metric for C-like languages, called ACPATH, that allows to quickly compute a very good estimation of the number of acyclic execution paths through the given function. We show that, if the function body does not contain backward gotos and does not contain jumps into a loop from outside the loop (which is the case for all MISRA-compliant programs), then such estimation is actually exact.I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.