Generate Unit test
I have a question.
when parasoft generate test for input argument.what is
the procedure of generate values to test argument.for example consider func foo1()
int foo1(int x)
{
if (x < 10)
return 1;
else if (x >10 and x < 20 )
return 2;
else if ( x > 20 )
return 3;
else return 0;
}
for test x values that may be generate is :
0,1,1,9,10,11,19,20,21,max int,min int
this number shows that parasoft understand desicion condition and select approprate number to test boundry value.
now , if we have foo2():
int foo1(float f)
{
if (f < 2.75)
return 1;
else if (f >2.75 and f < 6.75 )
return 0;
else if ( f > 10.25 )
return 1;
else return 2;
}
in this example the values that generate by parasoft is :
maxposfloat,minposfloat,maxnegfloat,minnegfloat,0.0f,1.0f,1.0f,maxint,minint
we expect that values like 2.8,2.6,6.74,6.73,10.24,10.26,and so on generate.
please explain that parasoft can generate this range of value for float and so on variables ?
tanks a lot
Comments

Hello @sunboy
For the source example with floatingpoint values, you should see test cases containing values used inside conditions. With floatingpoint values, heuristics work slightly differently due to floatingpoint comparison specifics.
Please doublecheck the limit of generated test cases in the test configuration's Generation>General>Max number of generated test cases (per. function).
If this value is low, like 4 or 6, you may not see these additional heuristicsbased test cases.
Also, please check the test configuration's Generation>Test Case> Use heuristic values for input parameters. It should be enabled.
1