Compare commits
2 Commits
53ac4a1cbd
...
a22f8bb6cb
Author | SHA1 | Date |
---|---|---|
Claudio Maggioni | a22f8bb6cb | |
Claudio Maggioni | 0ca300b35f |
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
title: Software Quality & Testing -- Graded Assignment 6
|
||||
author: Claudio Maggioni
|
||||
geometry: margin=2.5cm,bottom=3cm
|
||||
---
|
||||
|
||||
# Are there mutants that you cannot kill?
|
||||
|
||||
Yes.
|
||||
|
||||
# If yes, why and which are mutants that you cannot kill?
|
||||
|
||||
The mutants I cannot kill are:
|
||||
|
||||
```
|
||||
replaced boolean return with true for org/usi/sq/util/CircularFifoQueue::offer → SURVIVED
|
||||
```
|
||||
|
||||
at line 135 (which is impossible to kill since the parent method always returns true, thus
|
||||
the mutant is semantically equivalent to the implementation), and:
|
||||
|
||||
```
|
||||
changed conditional boundary → SURVIVED
|
||||
changed conditional boundary → SURVIVED
|
||||
negated conditional → SURVIVED
|
||||
```
|
||||
|
||||
for `if (start < lastReturnedIndex && pos < end)` at line 251.
|
Binary file not shown.
Binary file not shown.
|
@ -8,23 +8,23 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||
|
||||
class CircularFifoQueueTest {
|
||||
|
||||
private void testIteratorEmpty(Iterator<?> it) {
|
||||
private void testIteratorEmpty(final Iterator<?> it) {
|
||||
assertFalse(it.hasNext());
|
||||
assertThrows(NoSuchElementException.class, it::next);
|
||||
}
|
||||
|
||||
private <T> void testIteratorNext(Iterator<T> it, T e) {
|
||||
private <T> void testIteratorNext(final Iterator<T> it, final T e) {
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(e, it.next());
|
||||
}
|
||||
|
||||
private <T> void testQueueAll(int initQueueSize, List<T> values, long removeQueueCount, List<Integer> itrRemoveIndexes) {
|
||||
private <T> void testQueue(final int initQueueSize, final List<T> values, final long removeQueueCount, final List<Integer> itrRemoveIndexes) {
|
||||
final Set<Integer> removeIndexesSet = new HashSet<>(itrRemoveIndexes);
|
||||
|
||||
final CircularFifoQueue<T> queue = new CircularFifoQueue<>(initQueueSize);
|
||||
for (T e : values) assertTrue(queue.offer(e));
|
||||
|
||||
int queueSizeAfterOffers = Math.min(initQueueSize, values.size());
|
||||
final int queueSizeAfterOffers = Math.min(initQueueSize, values.size());
|
||||
for (int i = 0; i < removeQueueCount; i++) {
|
||||
assertEquals(values.get(values.size() - queueSizeAfterOffers + i), queue.remove());
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class CircularFifoQueueTest {
|
|||
|
||||
// Test Iteration
|
||||
for (int i = 0; i < expected.size(); i++) {
|
||||
T e = expected.get(i);
|
||||
final T e = expected.get(i);
|
||||
testIteratorNext(it, e);
|
||||
|
||||
if (removeIndexesSet.contains(i)) {
|
||||
|
@ -58,8 +58,18 @@ class CircularFifoQueueTest {
|
|||
testIteratorEmpty(itNew);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public final <T> List<T> list(final T... es) {
|
||||
return Arrays.asList(es);
|
||||
}
|
||||
|
||||
public final List<Integer> range(final int start, final int end) {
|
||||
if (end < start) throw new IllegalArgumentException();
|
||||
|
||||
final List<Integer> toReturn = new ArrayList<>(end - start);
|
||||
for (int i = start; i < end; i++) toReturn.add(i);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIterator() {
|
||||
|
@ -67,23 +77,19 @@ class CircularFifoQueueTest {
|
|||
assertThrows(NoSuchElementException.class, () -> new CircularFifoQueue<Void>().remove());
|
||||
assertThrows(NullPointerException.class, () -> new CircularFifoQueue<Void>().offer(null));
|
||||
|
||||
testQueueIteratorRemove(10, Arrays.asList(1, 2, 3), 0, 2);
|
||||
testQueueIteratorRemove(3, Arrays.asList(1, 2, 3), 0, 2);
|
||||
testQueueIteratorRemove(3, Arrays.asList(1, 2, 3), 0, 2);
|
||||
testQueueIteratorRemove(2, Arrays.asList(1, 2, 3));
|
||||
testQueueIteratorRemove(4, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9), 1, 3);
|
||||
testQueueAll(7, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), 4, Arrays.asList(1, 3));
|
||||
final List<Integer> empty = Collections.emptyList();
|
||||
|
||||
testQueueIteratorRemove(4, Arrays.asList(1, 2, 3, 4, 5), 1, 3);
|
||||
testQueueIteratorRemove(10, Collections.emptyList());
|
||||
testQueueQueueRemove(4, Arrays.asList(1, 2, 3, 4, 5), 1);
|
||||
testQueue(10, range(0, 3), 0, list(0, 2));
|
||||
testQueue(3, range(0, 3), 0, list(0, 2));
|
||||
testQueue(3, range(0, 3), 0, list(0, 2));
|
||||
testQueue(2, range(0, 3), 0, empty);
|
||||
testQueue(4, range(0, 9), 0, list(1, 3));
|
||||
testQueue(7, range(0, 13), 4, list(1, 3));
|
||||
testQueue(7, range(0, 13), 2, list(0, 2, 4, 5, 6));
|
||||
testQueue(5, range(0, 34), 2, list(0, 2, 4));
|
||||
testQueue(4, range(0, 5), 0, list(1, 3));
|
||||
testQueue(10, empty, 0, empty);
|
||||
testQueue(4, range(0, 5), 1, empty);
|
||||
}
|
||||
|
||||
private void testQueueQueueRemove(int i, List<Integer> asList, int i1) {
|
||||
testQueueAll(i, asList, i1, Collections.emptyList());
|
||||
}
|
||||
|
||||
private void testQueueIteratorRemove(int i, List<Integer> asList, Integer... asList1) {
|
||||
testQueueAll(i, asList, 0, Arrays.asList(asList1));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue