Problem with pit mutation: "Replaced long addition with subtraction"

133 Views Asked by At

I'm newbie with mutation testing. I'm using Pit and in the following line of code there are 4 mutations of the same type: Replaced long addition with subtraction long newsize = position + START_OF_DATA + total; But I can't figured out why he gaves me 4 mutations and not 3:

1 mutation:long newsize = position - START_OF_DATA + total;
2 mutation:long newsize = position + START_OF_DATA - total;
3 mutation:long newsize = position - START_OF_DATA - total;
4 mutation: ???

This is the context of the line:

try {
    fc.position(position + START_OF_DATA);
    while (buffs[buffs.length - 1].remaining() > 0) {
        long rc = fc.write(buffs);
        if (rc <= 0) {
            throw new IOException("Short write");
        }
        total += rc;
    }
} finally {
    fc.force(true);
    long newsize = position + START_OF_DATA + total;
    if (newsize > size) {
        size = newsize;
    }
}

I've also tried to manually modify the source code with this three supposed mutation and my test suite failed. Which one could be the fourth mutation? Is there a way to see in clear the mutations and not just the list with the original code reported in the pit report?

Thanks to all

0

There are 0 best solutions below