File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ use Fhaculty \Graph \Algorithm \Directed as AlgorithmDirected ;
4
+ use Fhaculty \Graph \Graph ;
5
+
6
+ class DirectedTest extends TestCase
7
+ {
8
+ public function testGraphEmpty ()
9
+ {
10
+ $ graph = new Graph ();
11
+
12
+ $ alg = new AlgorithmDirected ($ graph );
13
+
14
+ $ this ->assertFalse ($ alg ->isDirected ());
15
+ }
16
+
17
+ public function testGraphUndirected ()
18
+ {
19
+ // 1 -- 2
20
+ $ graph = new Graph ();
21
+ $ graph ->createVertex (1 )->createEdge ($ graph ->createVertex (2 ));
22
+
23
+ $ alg = new AlgorithmDirected ($ graph );
24
+
25
+ $ this ->assertFalse ($ alg ->isDirected ());
26
+ }
27
+
28
+ public function testGraphDirected ()
29
+ {
30
+ // 1 -> 2
31
+ $ graph = new Graph ();
32
+ $ graph ->createVertex (1 )->createEdgeTo ($ graph ->createVertex (2 ));
33
+
34
+ $ alg = new AlgorithmDirected ($ graph );
35
+
36
+ $ this ->assertTrue ($ alg ->isDirected ());
37
+ }
38
+
39
+ public function testGraphMixed ()
40
+ {
41
+ // 1 -- 2 -> 3
42
+ $ graph = new Graph ();
43
+ $ graph ->createVertex (1 )->createEdge ($ graph ->createVertex (2 ));
44
+ $ graph ->getVertex (2 )->createEdgeTo ($ graph ->createVertex (3 ));
45
+
46
+ $ alg = new AlgorithmDirected ($ graph );
47
+
48
+ $ this ->assertTrue ($ alg ->isDirected ());
49
+ }
50
+ }
You can’t perform that action at this time.
0 commit comments