Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIT is generating equivalent mutations #1324

Open
zsombor-balogh-dt opened this issue Apr 9, 2024 · 0 comments
Open

PIT is generating equivalent mutations #1324

zsombor-balogh-dt opened this issue Apr 9, 2024 · 0 comments

Comments

@zsombor-balogh-dt
Copy link

Hi,

I noticed that Pitest generated a few false mutants, which are equivalent to the original source code, and as a result, they survived. I found a similar previous issue: #497. However, it seems that in certain cases, the fix doesn’t work, or I might be missing some configurations.
Currently using 1.15.0 version with gradle.

  public boolean example(int maxSize, Duration maxAge) {
    lock.readLock().lock();
    try {
      int size = elements.size();
      if (size == 0) {
        return false; // -> replaced boolean return with false for com.example.Example::example → SURVIVED

      } else if (size >= maxSize) {
        return true; // -> replaced boolean return with true for com.example.Example::example → SURVIVED

      } else {
        long elapsedNanos = ticker.read() - timeOfLastReset;
        return elapsedNanos >= maxAge.toNanos();
      }

    } finally {
      lock.readLock().unlock();
    }
  }
}

Is there a config missing at our side or is it a known bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant