Howto distiguish two or more "changed conditional boundary" mutations in one line?

1,156 views
Skip to first unread message

Christian Schwarz

unread,
Mar 4, 2016, 8:01:36 AM3/4/16
to PIT Users
I am writing a little Eclipse-PlugIn for PiTest (ePiTest) that supports text and linemarkes for uncovered lines and mutations.

Assume we have a method like this

public static int calc(int a, int b) {
       
if (a >= b)
           
return a - b;

       
return 0;
 
}

PiTest reports for the the first line "changed conditional boundary". For the user it is not clear in which way the condition was mutated. Since Eclipse-JDT provides access to the Java-AST, i can figure out which kind of condition is affected. With this information I can map the unmutated condition to the mutation, in this case ">=" is mutated to ">" (click here for more details). So i can change the detail message from "changed conditional boundary" to the more specific "changed '>=' to '>'".

Question: How can I distiguish two or more mutated conditions in a line?
E.g:
 if (a >= b || b==42)

I tried to get some informations out of the MutationDetails but neither index nor block seems to help here.







henry

unread,
Mar 4, 2016, 10:30:25 AM3/4/16
to PIT Users


On Friday, 4 March 2016 13:01:36 UTC, Christian Schwarz wrote:

Question: How can I distiguish two or more mutated conditions in a line?
E.g:
 if (a >= b || b==42)

I tried to get some informations out of the MutationDetails but neither index nor block seems to help here.


I'm don't think it will always be possible to go link a mutation back to a specific point in the AST.

You ought to be able map the block back to a subsections of the AST. In this case it should be possible to tell which mutant corresponds to a >= b and b == 42 based on this, but I think you will encounter other situations where there is no easy way to tell.

Henry


Reply all
Reply to author
Forward
0 new messages