本文整理汇总了PHP中Sequence::depth方法的典型用法代码示例。如果您正苦于以下问题:PHP Sequence::depth方法的具体用法?PHP Sequence::depth怎么用?PHP Sequence::depth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence::depth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDepth
public function testDepth()
{
$syntax = new Syntax();
$this->assertEquals(1, $syntax->depth());
$rule = new Rule($this->getMock('de\\weltraumschaf\\ebnf\\ast\\Node'));
$this->assertEquals(1, $rule->depth());
$syntax->addChild($rule);
$this->assertEquals(2, $syntax->depth());
$seq = new Sequence($this->getMock('de\\weltraumschaf\\ebnf\\ast\\Node'));
$this->assertEquals(1, $seq->depth());
$rule->addChild($seq);
$this->assertEquals(2, $rule->depth());
$this->assertEquals(3, $syntax->depth());
$ident = new Identifier($this->getMock('de\\weltraumschaf\\ebnf\\ast\\Node'));
$this->assertEquals(1, $ident->depth());
$seq->addChild($ident);
$this->assertEquals(2, $seq->depth());
$this->assertEquals(3, $rule->depth());
$this->assertEquals(4, $syntax->depth());
$loop = new Loop($this->getMock('de\\weltraumschaf\\ebnf\\ast\\Node'));
$this->assertEquals(1, $loop->depth());
$seq->addChild($loop);
$this->assertEquals(2, $seq->depth());
$this->assertEquals(3, $rule->depth());
$this->assertEquals(4, $syntax->depth());
$term = new Terminal($this->getMock('de\\weltraumschaf\\ebnf\\ast\\Node'));
$this->assertEquals(1, $term->depth());
$loop->addChild($term);
$this->assertEquals(2, $loop->depth());
$this->assertEquals(3, $seq->depth());
$this->assertEquals(4, $rule->depth());
$this->assertEquals(5, $syntax->depth());
}