Skip to content
This repository has been archived by the owner on Sep 12, 2019. It is now read-only.

Commit

Permalink
release proj 1
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsit committed Jul 2, 2019
1 parent 49c6d02 commit 6c845c7
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
10 changes: 10 additions & 0 deletions proj1/ArrayDequeTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import org.junit.Test;
import static org.junit.Assert.*;

public class ArrayDequeTest {

@Test
public void yourTestHere() {

}
}
64 changes: 64 additions & 0 deletions proj1/LinkedListDequeTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import org.junit.Test;
import static org.junit.Assert.*;

/** Performs some basic linked list tests. */
public class LinkedListDequeTest {

/** Adds a few things to the list, checking isEmpty() and size() are correct,
* finally printing the results. */
@Test
public void addIsEmptySizeTest() {
System.out.println("Running add/isEmpty/Size test.");
System.out.println("Make sure to uncomment the lines below (and delete this line).");
/*
LinkedListDeque<String> lld1 = new LinkedListDeque<>();
// Java will try to run the below code.
// If there is a failure, it will jump to the finally block before erroring.
// If all is successful, the finally block will also run afterwards.
try {
assertTrue(lld1.isEmpty());
lld1.addFirst("front");
assertEquals(1, lld1.size());
assertFalse(lld1.isEmpty());
lld1.addLast("middle");
assertEquals(2, lld1.size());
lld1.addLast("back");
assertEquals(3, lld1.size());
} finally {
// The deque will be printed at the end of this test
// or after the first point of failure.
System.out.println("Printing out deque: ");
lld1.printDeque();
}
*/
}

/** Adds an item, then removes an item, and ensures that dll is empty afterwards. */
@Test
public void addRemoveTest() {
System.out.println("Running add/remove test.");
System.out.println("Make sure to uncomment the lines below (and delete this line).");
/*
LinkedListDeque<Integer> lld1 = new LinkedListDeque<>();
try {
assertTrue(lld1.isEmpty());
lld1.addFirst(10);
assertFalse(lld1.isEmpty());
lld1.removeFirst();
assertTrue(lld1.isEmpty());
} finally {
System.out.println("Printing out deque: ");
lld1.printDeque();
}
*/
}
}

0 comments on commit 6c845c7

Please sign in to comment.