Bearsampp
2026.9.23
Toggle main menu visibility
Loading...
Searching...
No Matches
AcyclicTestTest.php
Go to the documentation of this file.
1
<?php
2
require_once dirname(__FILE__) .
'/helper.inc'
;
3
require_once
'Structures/Graph/Manipulator/AcyclicTest.php'
;
4
5
class
AcyclicTestTest
extends
\PHPUnit\Framework\TestCase
6
{
7
public
function
testIsAcyclicFalse
()
8
{
9
$graph =
new
Structures_Graph
();
10
$node1 =
new
Structures_Graph_Node
();
11
$graph->addNode($node1);
12
13
$node2 =
new
Structures_Graph_Node
();
14
$graph->addNode($node2);
15
$node1->connectTo($node2);
16
17
$node3 =
new
Structures_Graph_Node
();
18
$graph->addNode($node3);
19
$node2->connectTo($node3);
20
21
$node3->connectTo($node1);
22
23
$this->assertFalse(
24
Structures_Graph_Manipulator_AcyclicTest::isAcyclic
($graph),
25
'Graph is cyclic'
26
);
27
}
28
29
public
function
testIsAcyclicTrue
()
30
{
31
$graph =
new
Structures_Graph
();
32
$node1 =
new
Structures_Graph_Node
();
33
$graph->addNode($node1);
34
35
$node2 =
new
Structures_Graph_Node
();
36
$graph->addNode($node2);
37
$node1->connectTo($node2);
38
39
$node3 =
new
Structures_Graph_Node
();
40
$graph->addNode($node3);
41
$node2->connectTo($node3);
42
43
$this->assertTrue(
44
Structures_Graph_Manipulator_AcyclicTest::isAcyclic
($graph),
45
'Graph is acyclic'
46
);
47
}
48
}
49
?>
AcyclicTestTest
Definition
AcyclicTestTest.php:6
AcyclicTestTest\testIsAcyclicTrue
testIsAcyclicTrue()
Definition
AcyclicTestTest.php:29
AcyclicTestTest\testIsAcyclicFalse
testIsAcyclicFalse()
Definition
AcyclicTestTest.php:7
Structures_Graph_Manipulator_AcyclicTest\isAcyclic
static isAcyclic(&$graph)
Definition
AcyclicTest.php:124
Structures_Graph_Node
Definition
Node.php:57
Structures_Graph
sandbox
core
libs
php
pear
tests
Structures_Graph
tests
AcyclicTestTest.php
Generated by
1.17.0