hcoles / pitest

State of the art mutation testing system for the JVM
Apache License 2.0
1.68k stars 358 forks source link

Question about UOI1 and UOI2 #659

Open Vampire opened 5 years ago

Vampire commented 5 years ago

Is it intended that in this code:

private boolean allowCommandByChannelId(Message message) {
    return message.getChannel().getId() == channelId;
}

the Unary Operator Insertion mutators UOI1 and UOI2 manipulate the channelId field?

To kill this mutant, I need to call the method twice (actually the method that calls this method internally), or test after calling the method, that the field didn't change, which has not much to do with the intention of the test, that tests the behavior of that method.

hcoles commented 5 years ago

@LaurentTho3 I think this relate to pit rv.

LaurentTho3 commented 5 years ago

UOI1 and UOI2 were meant to recreate the AOIU operator described here https://cs.gmu.edu/~offutt/mujava/mutopsMethod.pdf . So yes, this is intended, although it does create some "nonsensical" or even equivalent mutants (e.g. when mutation a return statement).