Skip to content

Commit 919da02

Browse files
committed
Improve test coverage
1 parent c2d0671 commit 919da02

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

tests/MaxFlow/EdmondsKarpTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,30 @@ public function testEdgesUndirected()
7878
// $this->assertEquals(0.735802, $alg->getFlowMax());
7979
// }
8080

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+
81107
}

tests/MaximumMatching/FlowTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ public function testSingleEdge()
3131
$this->assertEquals(1, $alg->getNumberOfMatches());
3232
// actual edge instance returned
3333
$this->assertEquals(array($edge), $alg->getEdges());
34+
35+
// check
36+
$flowgraph = $alg->createGraph();
37+
$this->assertInstanceOf('Fhaculty\Graph\Graph', $flowgraph);
3438
}
3539

3640
/**

0 commit comments

Comments
 (0)