forked from checkstyle/checkstyle
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue checkstyle#12331: Test cases add to kill mutation for ModifedCo…
…ntrolVariableCheck
- Loading branch information
1 parent
8bfa87c
commit bcfc443
Showing
3 changed files
with
131 additions
and
198 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
99 changes: 99 additions & 0 deletions
99
...style/checks/coding/modifiedcontrolvariable/InputModifiedControlVariableKillMutation.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
ModifiedControlVariable | ||
skipEnhancedForLoopVariable = (default)false | ||
*/ | ||
|
||
package com.puppycrawl.tools.checkstyle.checks.coding.modifiedcontrolvariable; | ||
|
||
public class InputModifiedControlVariableKillMutation { | ||
|
||
// case value 99 --> MINUS_ASSIGN | ||
void method() { | ||
for (int i=0,k=0; i<10 && k < 10; ++i,++k) { | ||
i -= 3; // violation | ||
k -= 4; // violation | ||
} | ||
} | ||
|
||
// case value 100 --> STAR_ASSIGN | ||
void method1() { | ||
for (int i=0,k=0; i<10 && k < 10; ++i,++k) { | ||
i *= 3; // violation | ||
k *= 4; // violation | ||
} | ||
} | ||
|
||
// case value 101 --> DIV_ASSIGN | ||
void method2() { | ||
for (int i=0,k=0; i<10 && k < 10; ++i,++k) { | ||
i /= 3; // violation | ||
k /= 4; // violation | ||
} | ||
} | ||
|
||
// case value 102 --> MOD_ASSIGN | ||
void method3() { | ||
for (int i=0,k=0; i<10 && k < 10; ++i,++k) { | ||
i %= 3; // violation | ||
k %= 4; // violation | ||
} | ||
} | ||
|
||
// case value 103 --> SR_ASSIGN | ||
void method4() { | ||
for (int i=0,k=0; i<10 && k < 10; ++i,++k) { | ||
i >>= 3; // violation | ||
k >>= 4; // violation | ||
} | ||
} | ||
|
||
// case value 104 --> BSR_ASSIGN | ||
void method5() { | ||
for (int i=0,k=0; i<10 && k < 10; ++i,++k) { | ||
i >>>= 3; // violation | ||
k >>>= 4; // violation | ||
} | ||
} | ||
|
||
// case value 105 --> SL_ASSIGN | ||
void method6() { | ||
for (int i=0,k=0; i<10 && k < 10; ++i,++k) { | ||
i <<= 3; // violation | ||
k <<= 4; // violation | ||
} | ||
} | ||
|
||
// case value 106 --> BAND_ASSIGN | ||
void method7() { | ||
for (int i=0,k=0; i<10 && k < 10; ++i,++k) { | ||
i &= 3; // violation | ||
k &= 4; // violation | ||
} | ||
} | ||
|
||
// case value 107 --> BXOR_ASSIGN | ||
void method8() { | ||
for (int i=0,k=0; i<10 && k < 10; ++i,++k) { | ||
i ^= 3; // violation | ||
k ^= 4; // violation | ||
} | ||
} | ||
|
||
// case value 108 --> BOR_ASSIGN | ||
void method9() { | ||
for (int i=0,k=0; i<10 && k < 10; ++i,++k) { | ||
i |= 3; // violation | ||
k |= 4; // violation | ||
} | ||
} | ||
|
||
// case value 26 --> BOR_ASSIGN | ||
void method10() { | ||
for (int i=0,k=0; i<10 && k < 10; ++i,++k) { | ||
i--; // violation | ||
k--; // violation | ||
} | ||
} | ||
} |