Created
October 14, 2015 02:22
-
-
Save mchayapol/cc0f56895bc371dd0430 to your computer and use it in GitHub Desktop.
Test cases for Doubly Linked List
This file contains hidden or 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
| package edu.au.scitech.sc2101; | |
| import static org.junit.Assert.*; | |
| import org.junit.Test; | |
| public class DoublyLinkedListTest { | |
| @Test | |
| public void test01() { | |
| DoublyLinkedList list = new DoublyLinkedList(); | |
| list.add(10); list.add(5); list.add(7); | |
| list.add(1); list.add(8); | |
| // expect [10 5 7 1 8] | |
| String s = list.toString(); | |
| assertEquals("[10 5 7 1 8]",s); | |
| System.out.println(s); | |
| assertEquals(5, list.size()); | |
| } | |
| @Test | |
| public void test02() { | |
| DoublyLinkedList list = new DoublyLinkedList(); | |
| list.add(10); list.add(5); list.add(7); | |
| list.add(1); list.add(8); | |
| list.delete(0); | |
| assertEquals(4, list.size()); | |
| String s = list.toString(); | |
| assertEquals("[5 7 1 8]",s); | |
| System.out.println(s); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment