I am strengthening my Jenkins build process and adding a few more checks.

I just stumbled across Parameter value coverage, which alas only handles C# code.

Is there anything similar for C / C++ ?

Parameter Value Coverage (PVC) is the ability to track coverage of a method based on the common possible values for the parameters accepted by the method.

Current code coverage tools fail to take into consideration the possibility that a value for a parameter is not handled resulting in a bug. However, there may not be any code addressing this value in any way, introducing the possibility of obtaining 100% code coverage or line coverage (LC) without detecting the bug.

If the common values for types, especially primitive types and known types, are documented and methods that use them are required to have a test for each possible parameter value, bugs can be avoided.

The following is a table of parameter value requirements for an int or System.Int32 and string or System.String. A unit test should exist for each of the possible values in order to have 100% PVC.

A positive integer
A negative integer
int.MaxValue or 2,147,483,647
int.MinValue or -2,147,483,648

A null string
An empty string, String.Empty, or “”
One or more spaces ” “
One or more tabs ” “
A new line or Environment.NewLine
A valid string.
An invalid or junk string
Unicode characters such as Chinese

  • 1
    You want to know, for each category of parameter value, whether a function has been tested with just that category? (e.g., for a two-parameter function, that each parameter has been exercised independently)? Or that all combinations of parameter categories have been applied to a function? – Ira Baxter Nov 11 '15 at 10:09
  • Given the paucity of answers so far, I will take anything that I can get :-/ – Mawg says reinstate Monica Nov 11 '15 at 10:10
  • 1
    In the absence of alternatives: semanticdesigns.com/Company/Publications/TestCoverage.pdf – Ira Baxter Nov 11 '15 at 10:14
  • A very interesting read. I already use gcov to ensure that I get 100% code coverage in unit test.. But that doesn't cover what I describe in the question. Maybe I will code my own - FOSS always looks good on the CV/resume ;-) – Mawg says reinstate Monica Nov 14 '15 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.