File tree 1 file changed +17
-1
lines changed
src/test/java/by/andd3dfx/collections
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public void find() {
23
23
}
24
24
25
25
@ Test
26
- public void findForListWithLoop () {
26
+ public void findForListWithOddLengthLoop () {
27
27
Node node1 = new Node (10 );
28
28
Node node2 = new Node (11 , node1 );
29
29
Node node3 = new Node (12 , node2 );
@@ -38,6 +38,22 @@ public void findForListWithLoop() {
38
38
assertTrue (LoopInLinkedList .isPresent (node1 ));
39
39
}
40
40
41
+ @ Test
42
+ public void findForListWithEvenLengthLoop () {
43
+ Node node1 = new Node (10 );
44
+ Node node2 = new Node (11 , node1 );
45
+ Node node3 = new Node (12 , node2 );
46
+ Node node4 = new Node (13 , node3 );
47
+ Node node5 = new Node (14 , node4 );
48
+ node1 .setNext (node4 );
49
+
50
+ assertTrue (LoopInLinkedList .isPresent (node5 ));
51
+ assertTrue (LoopInLinkedList .isPresent (node4 ));
52
+ assertTrue (LoopInLinkedList .isPresent (node3 ));
53
+ assertTrue (LoopInLinkedList .isPresent (node2 ));
54
+ assertTrue (LoopInLinkedList .isPresent (node1 ));
55
+ }
56
+
41
57
@ Test
42
58
public void findForSingleNodeWithLoop () {
43
59
Node head = new Node (10 );
You can’t perform that action at this time.
0 commit comments