Exemplo n.º 1
0
 function testPathsValid()
 {
     $ctx = new Context();
     $ctx->push('a', 'a');
     $ctx->push('a', 'a');
     $ctx->push('a', 'a');
     $ctx->pop('a');
     $ctx->push('b', 'b');
     $ctx->getNode()->valid = false;
     $ctx->pop('b');
     $ctx->pop('a');
     $ctx->push('b', 'b');
     $ctx->getNode()->valid = false;
     $ctx->pop('b');
     $ctx->push('c', 'c');
     $ctx->pop('c');
     $ctx->push('d', 'd');
     $ctx->pop('d');
     $ctx->pop('a');
     $this->assertTrue($ctx->pathsValid([['a', 'c'], ['a', 'd']]));
     $this->assertFalse($ctx->pathsValid(['a', 'a', 'b'], ['a', 'c']));
     $this->assertFalse($ctx->pathsValid(['a', 'a', 'a'], ['a', 'a', 'b']));
     $this->assertFalse($ctx->pathsValid(['a', 'a', 'b'], ['a', 'b']));
 }