I have a simple Method that returns the exponential value from a given number:
public int Exp(int num)
{
return Convert.ToInt32(System.Math.Exp(num));
}
When running Pex I get an OverFlowException in the Summary/Exception field for a certain large number: 1969057606.
How could I create a Post Condition using Contract.Ensure()
?
I tried the following but it does not do anything:
Contract.Ensures(Contract.Result<int>() < 2147483647);
// This is because the max value an int variable can hold is 2147483647