Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/diff/view/__tests__/PHUIDiffGraphViewTestCase.php
Show All 39 Lines | public function testReverseTree() { | ||||
); | ); | ||||
$graph = $this->newGraph($nodes); | $graph = $this->newGraph($nodes); | ||||
$picture = array( | $picture = array( | ||||
'^', | '^', | ||||
'|^', | '|^', | ||||
'o ', | 'o ', | ||||
'|^', | '| ^', | ||||
'||^', | '| |^', | ||||
'o ', | 'o ', | ||||
'x', | 'x ', | ||||
); | ); | ||||
$this->assertGraph($picture, $graph, pht('Reverse Tree')); | $this->assertGraph($picture, $graph, pht('Reverse Tree')); | ||||
} | } | ||||
public function testJoinTerminateTree() { | public function testJoinTerminateTree() { | ||||
$nodes = array( | $nodes = array( | ||||
'A' => array('D'), | 'A' => array('D'), | ||||
'B' => array('C'), | 'B' => array('C'), | ||||
'C' => array('D'), | 'C' => array('D'), | ||||
'D' => array(), | 'D' => array(), | ||||
); | ); | ||||
$graph = $this->newGraph($nodes); | $graph = $this->newGraph($nodes); | ||||
$picture = array( | $picture = array( | ||||
'^', | '^', | ||||
'|^', | '|^', | ||||
'|o', | '|o', | ||||
'x ', | 'x ', | ||||
); | ); | ||||
$this->assertGraph($picture, $graph, pht('Reverse Tree')); | $this->assertGraph($picture, $graph, pht('Terminated Tree')); | ||||
} | |||||
public function testThreeWayGraphJoin() { | |||||
$nodes = array( | |||||
'A' => array('D', 'C', 'B'), | |||||
'B' => array('D'), | |||||
'C' => array('B', 'E', 'F'), | |||||
'D' => array(), | |||||
'E' => array(), | |||||
'F' => array(), | |||||
); | |||||
$graph = $this->newGraph($nodes); | |||||
$picture = array( | |||||
'^', | |||||
'||o', | |||||
'|o|', | |||||
'x| ||', | |||||
' | x|', | |||||
' | x', | |||||
); | |||||
$this->assertGraph($picture, $graph, pht('Three-Way Tree')); | |||||
} | } | ||||
private function newGraph(array $nodes) { | private function newGraph(array $nodes) { | ||||
return id(new PHUIDiffGraphView()) | return id(new PHUIDiffGraphView()) | ||||
->setIsHead(true) | ->setIsHead(true) | ||||
->setIsTail(true) | ->setIsTail(true) | ||||
->renderRawGraph($nodes); | ->renderRawGraph($nodes); | ||||
} | } | ||||
Show All 12 Lines |