SettingsLogic.java

1
package io.github.some_example_name;
2
3
/**
4
 * Pure logic for settings (no LibGDX).
5
 */
6
public class SettingsLogic {
7
8
    private float volume;
9
10
    public SettingsLogic(float initialVolume) {
11 2 1. <init> : changed conditional boundary → KILLED
2. <init> : negated conditional → KILLED
        if (initialVolume <= 0f) {
12
            this.volume = 0.5f;
13
        } else {
14
            this.volume = clamp(initialVolume);
15
        }
16
    }
17
18
    public void setVolume(float volume) {
19
        this.volume = clamp(volume);
20
    }
21
22
    public float getVolume() {
23 1 1. getVolume : replaced float return with 0.0f for io/github/some_example_name/SettingsLogic::getVolume → KILLED
        return volume;
24
    }
25
26
    private float clamp(float value) {
27 1 1. clamp : replaced float return with 0.0f for io/github/some_example_name/SettingsLogic::clamp → KILLED
        return Math.max(0.01f, Math.min(1f, value));
28
    }
29
}

Mutations

11

1.1
Location : <init>
Killed by : io.github.some_example_name.SettingsLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SettingsLogicTest]/[method:constructor_setsDefaultVolume_whenInitialVolumeIsZero()]
changed conditional boundary → KILLED

2.2
Location : <init>
Killed by : io.github.some_example_name.SettingsLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SettingsLogicTest]/[method:constructor_setsDefaultVolume_whenInitialVolumeIsZero()]
negated conditional → KILLED

23

1.1
Location : getVolume
Killed by : io.github.some_example_name.SettingsLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SettingsLogicTest]/[method:constructor_setsDefaultVolume_whenInitialVolumeIsZero()]
replaced float return with 0.0f for io/github/some_example_name/SettingsLogic::getVolume → KILLED

27

1.1
Location : clamp
Killed by : io.github.some_example_name.SettingsLogicTest.[engine:junit-jupiter]/[class:io.github.some_example_name.SettingsLogicTest]/[method:setVolume_acceptsValidRange()]
replaced float return with 0.0f for io/github/some_example_name/SettingsLogic::clamp → KILLED

Active mutators

Tests examined


Report generated by PIT 1.15.0