Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
--TEST--
2
Unit test for graph with ports
3
--FILE--
4
<?php
5
 
6
/**
7
 * Test 12: "Graph of binary search tree"
8
 *
9
 * Graph definition taken from GraphViz documentation
10
 *
11
 * @category Image
12
 * @package  Image_GraphViz
13
 * @author   Philippe Jausions <jausions@php.net>
14
 */
15
require_once 'Image/GraphViz.php';
16
 
17
$graph = new Image_GraphViz(true, array(), 'structs', false);
18
 
19
$graph->addNode('node0', array('shape' => 'record',
20
                                 'label' => '<f0> |<f1> G|<f2> '));
21
$graph->addNode('node1', array('shape' => 'record',
22
                                 'label' => '<f0> |<f1> E|<f2> '));
23
$graph->addNode('node2', array('shape' => 'record',
24
                                 'label' => '<f0> |<f1> B|<f2> '));
25
$graph->addNode('node3', array('shape' => 'record',
26
                                 'label' => '<f0> |<f1> F|<f2> '));
27
$graph->addNode('node4', array('shape' => 'record',
28
                                 'label' => '<f0> |<f1> R|<f2> '));
29
$graph->addNode('node5', array('shape' => 'record',
30
                                 'label' => '<f0> |<f1> H|<f2> '));
31
$graph->addNode('node6', array('shape' => 'record',
32
                                 'label' => '<f0> |<f1> Y|<f2> '));
33
$graph->addNode('node7', array('shape' => 'record',
34
                                 'label' => '<f0> |<f1> A|<f2> '));
35
$graph->addNode('node8', array('shape' => 'record',
36
                                 'label' => '<f0> |<f1> C|<f2> '));
37
 
38
$graph->addEdge(array('node0' => 'node4'), null,
39
                array('node0' => 'f2', 'node4' => 'f1'));
40
$graph->addEdge(array('node0' => 'node1'), null,
41
                array('node0' => 'f0', 'node1' => 'f1'));
42
$graph->addEdge(array('node1' => 'node2'), null,
43
                array('node1' => 'f0', 'node2' => 'f1'));
44
$graph->addEdge(array('node1' => 'node3'), null,
45
                array('node1' => 'f2', 'node3' => 'f1'));
46
$graph->addEdge(array('node2' => 'node8'), null,
47
                array('node2' => 'f2', 'node8' => 'f1'));
48
$graph->addEdge(array('node2' => 'node7'), null,
49
                array('node2' => 'f0', 'node7' => 'f1'));
50
$graph->addEdge(array('node4' => 'node6'), null,
51
                array('node4' => 'f2', 'node6' => 'f1'));
52
$graph->addEdge(array('node4' => 'node5'), null,
53
                array('node4' => 'f0', 'node5' => 'f1'));
54
 
55
echo $graph->parse();
56
 
57
?>
58
--EXPECT--
59
digraph structs {
60
    node0 [ shape=record,label="<f0> |<f1> G|<f2> " ];
61
    node1 [ shape=record,label="<f0> |<f1> E|<f2> " ];
62
    node2 [ shape=record,label="<f0> |<f1> B|<f2> " ];
63
    node3 [ shape=record,label="<f0> |<f1> F|<f2> " ];
64
    node4 [ shape=record,label="<f0> |<f1> R|<f2> " ];
65
    node5 [ shape=record,label="<f0> |<f1> H|<f2> " ];
66
    node6 [ shape=record,label="<f0> |<f1> Y|<f2> " ];
67
    node7 [ shape=record,label="<f0> |<f1> A|<f2> " ];
68
    node8 [ shape=record,label="<f0> |<f1> C|<f2> " ];
69
    node0:f2 -> node4:f1;
70
    node0:f0 -> node1:f1;
71
    node1:f0 -> node2:f1;
72
    node1:f2 -> node3:f1;
73
    node2:f2 -> node8:f1;
74
    node2:f0 -> node7:f1;
75
    node4:f2 -> node6:f1;
76
    node4:f0 -> node5:f1;
77
}