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