Skip to content

Commit 732f9d9

Browse files
author
Samuel Facchinello
committed
adjust tests
1 parent 3ecd135 commit 732f9d9

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/test/java/com/thealgorithms/backtracking/AllPathsFromSourceToTargetTest.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ void testForFirstCase() {
1313
int[][] a = {{0, 1}, {0, 2}, {0, 3}, {2, 0}, {2, 1}, {1, 3}};
1414
int source = 2;
1515
int destination = 3;
16-
List<List<Integer>> list2 = List.of(List.of(2, 0, 1, 3), List.of(2, 0, 3), List.of(2, 1, 3));
17-
List<List<Integer>> list1 = AllPathsFromSourceToTarget.allPathsFromSourceToTarget(vertices, a, source, destination);
18-
list2 = list1;
19-
assertIterableEquals(list1, list2);
16+
List<List<Integer>> expected = List.of(List.of(2, 0, 1, 3), List.of(2, 0, 3), List.of(2, 1, 3));
17+
List<List<Integer>> actual = AllPathsFromSourceToTarget.allPathsFromSourceToTarget(vertices, a, source, destination);
18+
19+
assertIterableEquals(expected, actual);
2020
}
2121

2222
@Test
@@ -25,10 +25,10 @@ void testForSecondCase() {
2525
int[][] a = {{0, 1}, {0, 2}, {0, 3}, {2, 0}, {2, 1}, {1, 3}, {1, 4}, {3, 4}, {2, 4}};
2626
int source = 0;
2727
int destination = 4;
28-
List<List<Integer>> list2 = List.of(List.of(0, 1, 3, 4), List.of(0, 1, 4), List.of(0, 2, 1, 3, 4), List.of(0, 2, 1, 4), List.of(0, 2, 4), List.of(0, 3, 4));
29-
List<List<Integer>> list1 = AllPathsFromSourceToTarget.allPathsFromSourceToTarget(vertices, a, source, destination);
30-
list2 = list1;
31-
assertIterableEquals(list1, list2);
28+
List<List<Integer>> expected = List.of(List.of(0, 1, 3, 4), List.of(0, 1, 4), List.of(0, 2, 1, 3, 4), List.of(0, 2, 1, 4), List.of(0, 2, 4), List.of(0, 3, 4));
29+
List<List<Integer>> actual = AllPathsFromSourceToTarget.allPathsFromSourceToTarget(vertices, a, source, destination);
30+
31+
assertIterableEquals(expected, actual);
3232
}
3333

3434
@Test
@@ -37,10 +37,10 @@ void testForThirdCase() {
3737
int[][] a = {{1, 0}, {2, 3}, {0, 4}, {1, 5}, {4, 3}, {0, 2}, {0, 3}, {1, 2}, {0, 5}, {3, 4}, {2, 5}, {2, 4}};
3838
int source = 1;
3939
int destination = 5;
40-
List<List<Integer>> list2 = List.of(List.of(1, 0, 2, 5), List.of(1, 0, 5), List.of(1, 5), List.of(1, 2, 5));
41-
List<List<Integer>> list1 = AllPathsFromSourceToTarget.allPathsFromSourceToTarget(vertices, a, source, destination);
42-
list2 = list1;
43-
assertIterableEquals(list1, list2);
40+
List<List<Integer>> expected = List.of(List.of(1, 0, 2, 5), List.of(1, 0, 5), List.of(1, 5), List.of(1, 2, 5));
41+
List<List<Integer>> actual = AllPathsFromSourceToTarget.allPathsFromSourceToTarget(vertices, a, source, destination);
42+
43+
assertIterableEquals(expected, actual);
4444
}
4545

4646
@Test
@@ -49,9 +49,9 @@ void testForFourthcase() {
4949
int[][] a = {{0, 1}, {0, 2}, {1, 2}};
5050
int source = 0;
5151
int destination = 2;
52-
List<List<Integer>> list2 = List.of(List.of(0, 1, 2), List.of(0, 2));
53-
List<List<Integer>> list1 = AllPathsFromSourceToTarget.allPathsFromSourceToTarget(vertices, a, source, destination);
54-
list2 = list1;
55-
assertIterableEquals(list1, list2);
52+
List<List<Integer>> expected = List.of(List.of(0, 1, 2), List.of(0, 2));
53+
List<List<Integer>> actual = AllPathsFromSourceToTarget.allPathsFromSourceToTarget(vertices, a, source, destination);
54+
55+
assertIterableEquals(expected, actual);
5656
}
5757
}

0 commit comments

Comments
 (0)