Exemplo n.º 1
0
 public function testDepth()
 {
     $ident = new Identifier($this->getMock('de\\weltraumschaf\\ebnf\\ast\\Node'));
     $this->assertEquals(1, $ident->depth());
 }
Exemplo n.º 2
0
 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());
 }