SafeLogic.java

1
package io.github.some_example_name;
2
3
public class SafeLogic {
4
    private final String code;
5
    private final StringBuilder input = new StringBuilder();
6
    private boolean checked = false;
7
    private boolean searched = false;
8
    private boolean message = false;
9
    private boolean triggered = false;
10
    private float wait = 3f;
11
12
    public SafeLogic(String code){
13
        this.code = code;
14
    }
15
16
    public boolean isChecked() {
17 2 1. isChecked : replaced boolean return with false for io/github/some_example_name/SafeLogic::isChecked → KILLED
2. isChecked : replaced boolean return with true for io/github/some_example_name/SafeLogic::isChecked → KILLED
        return checked;
18
    }
19
    public boolean isSearched() {
20 2 1. isSearched : replaced boolean return with true for io/github/some_example_name/SafeLogic::isSearched → SURVIVED
2. isSearched : replaced boolean return with false for io/github/some_example_name/SafeLogic::isSearched → KILLED
        return searched;
21
    }
22
    public boolean isMessage() {
23 2 1. isMessage : replaced boolean return with false for io/github/some_example_name/SafeLogic::isMessage → SURVIVED
2. isMessage : replaced boolean return with true for io/github/some_example_name/SafeLogic::isMessage → KILLED
        return message;
24
    }
25
    public boolean isTriggered() {
26 2 1. isTriggered : replaced boolean return with true for io/github/some_example_name/SafeLogic::isTriggered → SURVIVED
2. isTriggered : replaced boolean return with false for io/github/some_example_name/SafeLogic::isTriggered → KILLED
        return triggered;
27
    }
28
    public String getInput() {
29 1 1. getInput : replaced return value with "" for io/github/some_example_name/SafeLogic::getInput → KILLED
        return input.toString();
30
    }
31
32
    public void check(float distance, boolean ePressed) {
33 5 1. check : changed conditional boundary → SURVIVED
2. check : negated conditional → KILLED
3. check : negated conditional → KILLED
4. check : negated conditional → KILLED
5. check : negated conditional → KILLED
        if (!searched && !checked && ePressed && distance < 30f) {
34
            checked = true;
35 1 1. check : removed call to java/lang/StringBuilder::setLength → SURVIVED
            input.setLength(0);
36
        }
37
    }
38
39
    public void enterDigit(int digit) {
40 5 1. enterDigit : changed conditional boundary → SURVIVED
2. enterDigit : changed conditional boundary → SURVIVED
3. enterDigit : negated conditional → KILLED
4. enterDigit : negated conditional → KILLED
5. enterDigit : negated conditional → KILLED
        if (checked && digit >= 0 && digit <= 9) {
41 1 1. enterDigit : Replaced integer addition with subtraction → KILLED
            input.append((char) ('0' + digit));
42
        }
43
    }
44
45
    public void backspace() {
46 3 1. backspace : changed conditional boundary → SURVIVED
2. backspace : negated conditional → KILLED
3. backspace : negated conditional → KILLED
        if (checked && input.length() > 0) {
47 1 1. backspace : Replaced integer subtraction with addition → KILLED
            input.deleteCharAt(input.length() - 1);
48
        }
49
    }
50
51
    public void enter() {
52 1 1. enter : negated conditional → KILLED
        if (!checked) {
53
            return;
54
        }
55 1 1. enter : negated conditional → KILLED
        if (input.toString().equals(code)) {
56
            searched = true;
57
            message = true;
58
            triggered = true;
59
        }
60
        checked = false;
61
    }
62
63
    public void updateMessage(float delta) {
64 1 1. updateMessage : negated conditional → KILLED
        if (message) {
65 1 1. updateMessage : Replaced float subtraction with addition → KILLED
            wait -= delta;
66 2 1. updateMessage : negated conditional → KILLED
2. updateMessage : changed conditional boundary → KILLED
            if (wait <= 0) {
67
                message = false;
68
            }
69
        }
70
    }
71
}

Mutations

17

1.1
Location : isChecked
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:opensWhenClosedAndEPressed()]
replaced boolean return with false for io/github/some_example_name/SafeLogic::isChecked → KILLED

2.2
Location : isChecked
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:CannotOpenWhenFar()]
replaced boolean return with true for io/github/some_example_name/SafeLogic::isChecked → KILLED

20

1.1
Location : isSearched
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:submitCorrectCode()]
replaced boolean return with false for io/github/some_example_name/SafeLogic::isSearched → KILLED

2.2
Location : isSearched
Killed by : none
replaced boolean return with true for io/github/some_example_name/SafeLogic::isSearched → SURVIVED

23

1.1
Location : isMessage
Killed by : none
replaced boolean return with false for io/github/some_example_name/SafeLogic::isMessage → SURVIVED

2.2
Location : isMessage
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:messageDisappears()]
replaced boolean return with true for io/github/some_example_name/SafeLogic::isMessage → KILLED

26

1.1
Location : isTriggered
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:submitCorrectCode()]
replaced boolean return with false for io/github/some_example_name/SafeLogic::isTriggered → KILLED

2.2
Location : isTriggered
Killed by : none
replaced boolean return with true for io/github/some_example_name/SafeLogic::isTriggered → SURVIVED

29

1.1
Location : getInput
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:type()]
replaced return value with "" for io/github/some_example_name/SafeLogic::getInput → KILLED

33

1.1
Location : check
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:opensWhenClosedAndEPressed()]
negated conditional → KILLED

2.2
Location : check
Killed by : none
changed conditional boundary → SURVIVED

3.3
Location : check
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:opensWhenClosedAndEPressed()]
negated conditional → KILLED

4.4
Location : check
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:opensWhenClosedAndEPressed()]
negated conditional → KILLED

5.5
Location : check
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:opensWhenClosedAndEPressed()]
negated conditional → KILLED

35

1.1
Location : check
Killed by : none
removed call to java/lang/StringBuilder::setLength → SURVIVED

40

1.1
Location : enterDigit
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:type()]
negated conditional → KILLED

2.2
Location : enterDigit
Killed by : none
changed conditional boundary → SURVIVED

3.3
Location : enterDigit
Killed by : none
changed conditional boundary → SURVIVED

4.4
Location : enterDigit
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:type()]
negated conditional → KILLED

5.5
Location : enterDigit
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:type()]
negated conditional → KILLED

41

1.1
Location : enterDigit
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:type()]
Replaced integer addition with subtraction → KILLED

46

1.1
Location : backspace
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:backspace()]
negated conditional → KILLED

2.2
Location : backspace
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:backspace()]
negated conditional → KILLED

3.3
Location : backspace
Killed by : none
changed conditional boundary → SURVIVED

47

1.1
Location : backspace
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:backspace()]
Replaced integer subtraction with addition → KILLED

52

1.1
Location : enter
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:submitCorrectCode()]
negated conditional → KILLED

55

1.1
Location : enter
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:submitCorrectCode()]
negated conditional → KILLED

64

1.1
Location : updateMessage
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:messageDisappears()]
negated conditional → KILLED

65

1.1
Location : updateMessage
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:messageDisappears()]
Replaced float subtraction with addition → KILLED

66

1.1
Location : updateMessage
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:messageDisappears()]
negated conditional → KILLED

2.2
Location : updateMessage
Killed by : io.github.some_example_name.SafeLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SafeLogicTest]/[method:messageDisappears()]
changed conditional boundary → KILLED

Active mutators

Tests examined


Report generated by PIT 1.15.0