I'm writing tests for Junit to test a delete function that I wrote:
@Override
public T delete(int index) {
if (index < 0 || index > this.size()) {
throw new IndexOutOfBoundsException();
} else if (isEmpty()) {
throw new EmptyContainerException();
} else {
Node<T> current = front;
if (index == 0) {
front = current.next;
current.prev = null;
size--;
return current.data;
} else if (index == size - 1) {
return remove();
} else {
current = traverse(current, index);
Node<T> temp = current;
current.prev.next = current.next;
current.next.prev = current.prev;
size--;
return temp.data;
}
}
}
This method is for a double linked list that has both a back and front node.
THE PROBLEM: Our college will run buggy code against the tests we write to determine whether we've written enough tests to catch bad code and exceptions.
I know 2 of the tests that they will run, but don't know what the error means.
-
FAIL: MissingBackFieldRepairLogic
Unable to find bug with DoubleLinkedList with missing back field repair logic
-
FAIL: MissingNextNodeRepairLogic
Unable to find bug with DoubleLinkedList with missing next node repair logic
These^ are 2 tests that I have not accounted for as I'm unable to understand what theses errors mean. Does anyone have any idea about what these errors might be?
And what kind of tests should I write to catch these errors?
Thanks -A desperate student
Aucun commentaire:
Enregistrer un commentaire