-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
344 additions
and
69 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
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,151 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<mutations version="1.0"> | ||
<!-- The rules element describes all mutations done during a mutation test --> | ||
<!-- The following children are parsed: literal and regex --> | ||
<!-- A literal element matches the literal text --> | ||
<!-- A regex element mutates source code if the regular expression matches --> | ||
<!-- Each of them must have at least one mutation child --> | ||
<rules> | ||
<!-- A literal element matches the literal text and replaces it with the list of mutations --> | ||
<literal text="&&"> | ||
<mutation text="||"/> | ||
</literal> | ||
<literal text="||"> | ||
<mutation text="&&"/> | ||
</literal> | ||
<literal text="+"> | ||
<mutation text="-"/> | ||
<mutation text="*"/> | ||
</literal> | ||
<literal text="-"> | ||
<mutation text="+"/> | ||
<mutation text="*"/> | ||
</literal> | ||
<literal text="*"> | ||
<mutation text="+"/> | ||
<mutation text="-"/> | ||
</literal> | ||
<literal text="/"> | ||
<mutation text="*"/> | ||
<mutation text="+"/> | ||
</literal> | ||
<literal text="=="> | ||
<mutation text="!="/> | ||
</literal> | ||
<literal text="<="> | ||
<mutation text="=="/> | ||
<mutation text="<"/> | ||
</literal> | ||
<literal text=">="> | ||
<mutation text="=="/> | ||
<mutation text=">"/> | ||
</literal> | ||
<literal text="!="> | ||
<mutation text="=="/> | ||
</literal> | ||
<!-- It is also possible to match a regular expression with capture groups. --> | ||
<!-- If the optional attribute dotAll is set to true, then the . will also match newlines. --> | ||
<!-- If not present, the default value for dotAll is false. --> | ||
<!-- Here, we capture everything inside of the braces of "if ()" --> | ||
<regex pattern="[\s]if[\s]*\((.*?)\)[\s]*{" dotAll="true"> | ||
<!-- You can access groups via $1. --> | ||
<!-- If your string contains a $ followed by a number that should not be replaced, escape the dollar \$ --> | ||
<!-- If your string contains a \$ followed by a number that should not be replaced, escape the slash \\$ --> | ||
<!-- Tabs and newlines should also be escaped. --> | ||
<mutation text=" if (!($1)) {"/> | ||
</regex> | ||
<!-- Matches long chains of && --> | ||
<regex pattern="&([^&()]+?)&" dotAll="true"> | ||
<mutation text="&!($1)&"/> | ||
</regex> | ||
<!-- Matches long chains of || --> | ||
<regex pattern="\|([^|()]+?)\|" dotAll="true"> | ||
<mutation text="|!($1)|"/> | ||
</regex> | ||
<regex pattern="\(([^$(]*?)&&([^$()]*?)\)"> | ||
<mutation text="(!($1)&&$2)"/> | ||
<mutation text="($1&&!($2))"/> | ||
</regex> | ||
<regex pattern="\(([^|(]*?)\|\|([^()|]*?)\)"> | ||
<mutation text="(!($1)||$2)"/> | ||
<mutation text="($1||!($2))"/> | ||
</regex> | ||
<!-- Replace start of conditional block --> | ||
<regex pattern="if\s*\(([^|&\)]*?)([|&][|&])"> | ||
<mutation text="if (!($1)$2"/> | ||
</regex> | ||
<!-- Replace end of conditional block --> | ||
<regex pattern="([|&][|&])([^|&]*?)\)"> | ||
<mutation text="$1!($2))"/> | ||
</regex> | ||
<regex pattern="([|&][|&])[\s]*?\(" dotAll="true"> | ||
<mutation text="$1!("/> | ||
</regex> | ||
<!-- Replaces numbers with negative values --> | ||
<regex pattern="([\s=\(])([1-9\.]+[0-9]+|0\.0*[1-9])"> | ||
<mutation text="$1-$2"/> | ||
</regex> | ||
<!-- switch function call arguments. Matches 2 args --> | ||
<regex pattern="([\s][a-zA-z]*?[^\(;\s]*?)\s*\(([^,]*),([^,]*)\)\s*;"> | ||
<mutation text="$1($3,$2);"/> | ||
</regex> | ||
<!-- switch function call arguments. Matches 3 args --> | ||
<regex pattern="([\s][a-zA-z]*?[^\(;\s{}]*?)\s*\(([^,\n\(]*),([^,\n\(]*),([^,\n\(]*)\)\s*;"> | ||
<mutation text="$1($3,$2,$4);"/> | ||
<mutation text="$1($2,$4,$3);"/> | ||
</regex> | ||
<!-- switch function call arguments. Matches 4 args --> | ||
<regex pattern="([\s][a-zA-z]*?[^\(;\s{}]*?)\s*\(([^,\n\(]*),([^,\n\(]*),([^,\n\(]*),([^,\n\(]*)\)\s*;"> | ||
<mutation text="$1($3,$2,$4,$5);"/> | ||
<mutation text="$1($2,$4,$3,$5);"/> | ||
<mutation text="$1($2,$3,$5,$4);"/> | ||
</regex> | ||
</rules> | ||
<!-- This element creates a blacklist, allowing you to exclude parts from the mutations --> | ||
<exclude> | ||
<!-- excludes anything between two tokens --> | ||
<!-- single line comments --> | ||
<token begin="//" end="\n"/> | ||
<!-- exclude dart exports and imports --> | ||
<token begin="export '" end="';"/> | ||
<token begin="import '" end="';"/> | ||
<token begin="export "" end="";"/> | ||
<token begin="import "" end="";"/> | ||
|
||
<!-- exclude dart part and part of --> | ||
<token begin="part '" end="';"/> | ||
<token begin="part of '" end="';"/> | ||
<token begin="part "" end="";"/> | ||
<token begin="part of "" end="";"/> | ||
|
||
<!-- excludes anything that matches a pattern --> | ||
<!-- multi line comments --> | ||
<regex pattern="/[*].*?[*]/" dotAll="true"/> | ||
|
||
<!-- exclude increment and decrement operators. Produces mostly false positives. --> | ||
<regex pattern="\+\+"/> | ||
<regex pattern="--"/> | ||
|
||
<!-- exclude loops to prevent infinte tests --> | ||
<regex pattern="[\s]for[\s]*\(.*?\)[\s]*{" dotAll="true"/> | ||
<regex pattern="[\s]while[\s]*\(.*?\)[\s]*{.*?}" dotAll="true"/> | ||
|
||
<!-- lines can also be globally excluded --> | ||
<!-- line index starts at 1 --> | ||
<!-- lines begin="1" end="2"/--> | ||
</exclude> | ||
|
||
<!-- Configures the reporting thresholds as percentage of detected mutations --> | ||
<!-- Attribute failure is required and must be a floating point number. --> | ||
<!-- Note: There can only be one threshold element in all input files! --> | ||
<!-- If no threshold element is found, these values will be used. --> | ||
<threshold failure="80"> | ||
<!-- Provides reliability rating levels. Attributes are required. --> | ||
<rating over="100" name="A"/> | ||
<rating over="80" name="B"/> | ||
<rating over="60" name="C"/> | ||
<rating over="40" name="D"/> | ||
<rating over="20" name="E"/> | ||
<rating over="0" name="F"/> | ||
</threshold> | ||
</mutations> |
Oops, something went wrong.