This repository has been archived by the owner on Sep 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
*/ | ||
} | ||
} |