Question

I am running a test on some c# code and pex did not cover the statement with Math.Acos( it is part of a large switch statement). I am curious if anyone know why pex has this limitation? I looked online and could not find anything.

Was it helpful?

Solution

Pex builds up a system of constraints (a path condition) of the path it tries to cover next. It then relies on a constraint solver to generate a satisfying assignment for that constraint system. In some cases the constraint solver is not able to find values (within reasonable time). At the moment this mainly occurs for code that involves floating point variables or variables of decimal type.

For example, assume you want to satisfy the condition Math.Acos(x) <= y. Unless Pex can trace the path taken through the Math.Acos function by the input x in a previous execution (where Math.Acos(x) > y), the constraint solver would have to understand how Math.Acos works in order to solve that constraint.

Even if Pex has access to the implementation of Math.Acos, the resulting constraint system might still be too complicated for a constraint solver to handle within reasonable time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top