-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTarjanAlgorithmTest.java
More file actions
41 lines (33 loc) · 1.25 KB
/
TarjanAlgorithmTest.java
File metadata and controls
41 lines (33 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import junit.framework.Assert;
import org.junit.Test;
import java.io.File;
import java.util.ArrayList;
/**
* Created by Darkrengarius on 06.06.2016.
*/
public class TarjanAlgorithmTest {
@Test
public void testTarjanAlg () {
File graphFile = new File("C:\\JavaFiles\\input.txt");
ArrayList<ArrayList<Boolean>> graph = StrongConnectivitySearcher.readGraphFromFile(graphFile);
TarjanAlgorithm tarjanSearcher = new TarjanAlgorithm(graph);
ArrayList<ArrayList<Integer>> components = tarjanSearcher.findComponents();
ArrayList<ArrayList<Integer>> componentsTest = new ArrayList<>();
ArrayList<Integer> component1 = new ArrayList<>();
component1.add(0);
component1.add(1);
component1.add(2);
ArrayList<Integer> component2 = new ArrayList<>();
component2.add(3);
component2.add(4);
component2.add(5);
ArrayList<Integer> component3 = new ArrayList<>();
component3.add(6);
component3.add(7);
component3.add(8);
componentsTest.add(component1);
componentsTest.add(component2);
componentsTest.add(component3);
Assert.assertEquals(components, componentsTest);
}
}