Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void testLinkedListAddInTailWorksProperly() {
- LinkedList list = new LinkedList();
- Node node = new Node(0);
- list.addInTail(node);
- test(
- list.count() == 1,
- "List should have at least one element after adding one node to it"
- );
- test(
- list.head == node,
- "List head should be equal to node"
- );
- test(
- list.tail == node,
- "List tail should be equal to node"
- );
- Node node1 = new Node(1);
- list.addInTail(node1);
- test(
- list.count() == 2,
- "List should have two elements after adding two nodes to it"
- );
- test(
- list.head == node,
- "List head still should be equal to node"
- );
- test(
- list.tail == node1,
- "List tail should become node1"
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement