InvalidIODevice.java

1
// Copyright © 2004-2006 University of Helsinki, Department of Computer Science
2
// Copyright © 2012 various contributors
3
// This software is released under GNU Lesser General Public License 2.1.
4
// The license text is at http://www.gnu.org/licenses/lgpl-2.1.html
5
6
package fi.helsinki.cs.titokone.devices;
7
8
import fi.helsinki.cs.titokone.*;
9
import fi.helsinki.cs.ttk91.*;
10
11
/**
12
 * dummy device to actually do nothing and signify and invalid device
13
 */
14
public class InvalidIODevice
15
        implements IODevice {
16
    protected int size;
17
18
    public InvalidIODevice(int n) {
19 1
        this.size = n;
20
    }
21
22
    public int getPortCount() {
23 1
        return size;
24
    }
25
26
    @Override
27
    public int getPort(int n)
28
            throws TTK91RuntimeException {
29 4
        if (n >= 0 || n < size) {
30 3
            throw new TTK91InvalidDevice(new Message(Processor.INVALID_DEVICE_MESSAGE).toString());
31
        }
32 5
        throw new RuntimeException("should not happen " + n);
33
    }
34
35
    @Override
36
    public void setPort(int n, int value)
37
            throws TTK91RuntimeException {
38 4
        if (n >= 0 || n < size) {
39 3
            throw new TTK91InvalidDevice(new Message(Processor.INVALID_DEVICE_MESSAGE).toString());
40
        }
41 5
        throw new RuntimeException("should not happen " + n);
42
    }
43
44
    public void reset() {
45
    }
46
47
    public void update() {
48
    }
49
}

Mutations

19

Removed assignment to member variable size : SURVIVED

23

replaced return of integer sized value with (x == 0 ? 1 : 0) : SURVIVED

29

negated conditional : NO_COVERAGE

negated conditional : NO_COVERAGE

changed conditional boundary : NO_COVERAGE

changed conditional boundary : NO_COVERAGE

30

removed call to fi/helsinki/cs/ttk91/TTK91InvalidDevice::<init> : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/Message::<init> : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/Message::toString : NO_COVERAGE

32

removed call to java/lang/RuntimeException::<init> : NO_COVERAGE

removed call to java/lang/StringBuilder::<init> : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::toString : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

38

negated conditional : NO_COVERAGE

changed conditional boundary : NO_COVERAGE

changed conditional boundary : NO_COVERAGE

negated conditional : NO_COVERAGE

39

removed call to fi/helsinki/cs/ttk91/TTK91InvalidDevice::<init> : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/Message::<init> : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/Message::toString : NO_COVERAGE

41

removed call to java/lang/StringBuilder::<init> : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::toString : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/RuntimeException::<init> : NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 0.27