Add ACN Mutator (assert(...) Condition Negation)#3000
Open
sidarth16 wants to merge 3 commits intocrytic:masterfrom
Open
Add ACN Mutator (assert(...) Condition Negation)#3000sidarth16 wants to merge 3 commits intocrytic:masterfrom
assert(...) Condition Negation)#3000sidarth16 wants to merge 3 commits intocrytic:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces
ACN(Assert Condition Negation) to the mutator set.The mutator rewrites the first condition argument of
assert(...)by wrapping it in a negation, so assertion-style guards can be flipped during mutation testing.Examples:
assert(x > 0 && x < 10)becomesassert(!(x > 0 && x < 10))assert(msg.sender == owner)becomesassert(!(msg.sender == owner))assert(!isOwner)becomesassert(!(!isOwner))Changes
ACNmutator:slither/tools/mutator/mutators/ACN.pyassert(...)calls & generates a patch that rewrites the condition as!(...)ACNmutator in:slither/tools/mutator/mutators/all_mutators.pyassert(..)statement intests/tools/mutator/test_data/test_source_unit/src/Counter.soltests/tools/mutator/test_mutator.pytesting theACNmutatorNotes
assert(...)mutations.require(...)variant is being handled separately in PR Add RCN Mutator (require(...)Condition Negation) #2998.ACNis listed with# severity mediuminall_mutators.pyfor consistency with the existing mutator list comments.ACNis counted as tweak mutant by current framework rules (RR/CRspecial-cased)Fixes #2999