SvcNames.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;
7
8
import java.util.Collections;
9
import java.util.HashMap;
10
import java.util.Map;
11
12
public class SvcNames {
13
    public static final Map<String, Integer> SVCS;
14
15
    static {
16 1
        Map<String, Integer> devs = new HashMap<String, Integer>();
17 4
        devs.put("halt", 11);
18 4
        devs.put("read", 12);
19 4
        devs.put("write", 13);
20 4
        devs.put("time", 14);
21 4
        devs.put("date", 15);
22 1
        SVCS = Collections.unmodifiableMap(devs);
23
    }
24
25
    public static Integer lookupIgnoringCase(String name) {
26 3
        return SVCS.get(name.toLowerCase());
27
    }
28
29
    public static String lookupByValue(int value) {
30 5
        for(Map.Entry<String, Integer> entries : SVCS.entrySet())
31 3
            if(entries.getValue() == value)
32 2
                return entries.getKey();
33 1
        return null;
34
    }
35
}

Mutations

16

removed call to java/util/HashMap::<init> : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

17

Replaced constant value of 11 with 12 : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

Substituted 11 with 12 : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

removed call to java/util/Map::put : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

removed call to java/lang/Integer::valueOf : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

18

removed call to java/lang/Integer::valueOf : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

Replaced constant value of 12 with 13 : SURVIVED

Substituted 12 with 13 : SURVIVED

removed call to java/util/Map::put : SURVIVED

19

removed call to java/lang/Integer::valueOf : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

Substituted 13 with 14 : SURVIVED

removed call to java/util/Map::put : SURVIVED

Replaced constant value of 13 with 14 : SURVIVED

20

Replaced constant value of 14 with 15 : SURVIVED

removed call to java/util/Map::put : SURVIVED

removed call to java/lang/Integer::valueOf : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

Substituted 14 with 15 : SURVIVED

21

Substituted 15 with 16 : SURVIVED

removed call to java/util/Map::put : SURVIVED

removed call to java/lang/Integer::valueOf : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

Replaced constant value of 15 with 16 : SURVIVED

22

removed call to java/util/Collections::unmodifiableMap : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

26

mutated return of Object value for fi/helsinki/cs/titokone/SvcNames::lookupIgnoringCase to ( if (x != null) null else throw new RuntimeException ) : NO_COVERAGE

removed call to java/lang/String::toLowerCase : NO_COVERAGE

removed call to java/util/Map::get : NO_COVERAGE

30

removed call to java/util/Iterator::next : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

removed call to java/util/Set::iterator : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

removed call to java/util/Iterator::hasNext : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

negated conditional : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

removed call to java/util/Map::entrySet : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

31

removed call to java/lang/Integer::intValue : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

negated conditional : KILLED -> fi.helsinki.cs.titokone.BinaryInterpreterTest.testBinaryToString(fi.helsinki.cs.titokone.BinaryInterpreterTest)

removed call to java/util/Map$Entry::getValue : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

32

removed call to java/util/Map$Entry::getKey : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

mutated return of Object value for fi/helsinki/cs/titokone/SvcNames::lookupByValue to ( if (x != null) null else throw new RuntimeException ) : KILLED -> fi.helsinki.cs.titokone.BinaryTest.testBinaryToApplication(fi.helsinki.cs.titokone.BinaryTest)

33

mutated return of Object value for fi/helsinki/cs/titokone/SvcNames::lookupByValue to ( if (x != null) null else throw new RuntimeException ) : NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 0.27