Exemplo n.º 1
0
 function it_can_be_converted_to_a_DFA(State $state, Symbol $symbol)
 {
     $state->getReachableStatesBySymbol(Argument::type(EpsilonSymbol::class))->willReturn([]);
     $state->getReachableSymbols()->willReturn([]);
     $state->isFinal()->willReturn(false);
     $this->addStartingState($state);
     $this->toDFA()->shouldBeAnInstanceOf(DFA::class);
 }
Exemplo n.º 2
0
 function it_returns_the_advanced_closure_for_a_symbol(Symbol $symbol, State $state1, State $state2, State $state3, State $state4)
 {
     $state1->getReachableStatesBySymbol($symbol)->willReturn([$state2]);
     $state2->getReachableStatesBySymbol($symbol)->willReturn([$state3]);
     $state3->getReachableStatesBySymbol($symbol)->willReturn([$state4]);
     $state4->getReachableStatesBySymbol($symbol)->willReturn([$state1]);
     $this->advance($symbol)->shouldBeAnInstanceOf(Closure::class);
 }