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

BigInteger mutator #518

Merged
merged 24 commits into from
Oct 8, 2018
Merged

Conversation

ripdajacker
Copy link

@ripdajacker ripdajacker commented Sep 18, 2018

My colleague and I added a new experimental mutator that mutates BigInteger methods in the same manner as the MathMutator does for ints and longs.

The mutator also swaps methods that are not present on the primitives:

  • andNot <> and
  • setBit <> clearBit
  • flipBit > setBit
  • not <> negate
  • max <> min
  • abs > negate

We think this is a useful addition and would love to hear some feedback.

Note: The branch has BigDecimal in the name, but BigDecimal is much more complicated so we opted to do a test with BigInteger first.

@ripdajacker ripdajacker changed the title Bigint bigdecimal mutator BigInteger mutator Sep 18, 2018
@hcoles
Copy link
Owner

hcoles commented Oct 1, 2018

Thanks for this - finally got chance to have a look over it yesterday.

I agree this would be good to add in. In the longer term I think it might be possible to replace this with a more generalised method swap mutator, but that will require some changes to pitest to implement so it unlikely to happen soon.

If you can fill in the holes in the test suite (at the moment the tests only demonstrate swapping a subset of the subsituted methods) I'll merge it in.

@ripdajacker
Copy link
Author

We added tests for the rest of the methods.

@hcoles hcoles merged commit 2ce5d7c into hcoles:master Oct 8, 2018
@hcoles
Copy link
Owner

hcoles commented Oct 8, 2018

Thanks! It is not accessible as EXPERIMENTAL_BIG_INTEGER in the master branch

@ripdajacker ripdajacker deleted the bigint-bigdecimal-mutator branch October 9, 2018 19:35
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

Successfully merging this pull request may close these issues.

None yet

3 participants