File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -78,4 +78,30 @@ public function testEdgesUndirected()
78
78
// $this->assertEquals(0.735802, $alg->getFlowMax());
79
79
// }
80
80
81
+
82
+ /**
83
+ * @expectedException InvalidArgumentException
84
+ */
85
+ public function testInvalidFlowToOtherGraph ()
86
+ {
87
+ $ graph1 = new Graph ();
88
+ $ vg1 = $ graph1 ->createVertex (1 );
89
+
90
+ $ graph2 = new Graph ();
91
+ $ vg2 = $ graph2 ->createVertex (2 );
92
+
93
+ new AlgorithmMaxFlowEdmondsKarp ($ vg1 , $ vg2 );
94
+ }
95
+
96
+ /**
97
+ * @expectedException InvalidArgumentException
98
+ */
99
+ public function testInvalidFlowToSelf ()
100
+ {
101
+ $ graph = new Graph ();
102
+ $ v1 = $ graph ->createVertex (1 );
103
+
104
+ new AlgorithmMaxFlowEdmondsKarp ($ v1 , $ v1 );
105
+ }
106
+
81
107
}
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ public function testSingleEdge()
31
31
$ this ->assertEquals (1 , $ alg ->getNumberOfMatches ());
32
32
// actual edge instance returned
33
33
$ this ->assertEquals (array ($ edge ), $ alg ->getEdges ());
34
+
35
+ // check
36
+ $ flowgraph = $ alg ->createGraph ();
37
+ $ this ->assertInstanceOf ('Fhaculty\Graph\Graph ' , $ flowgraph );
34
38
}
35
39
36
40
/**
You can’t perform that action at this time.
0 commit comments