Skip to content

Instantly share code, notes, and snippets.

@jcbozonier
Created November 8, 2009 18:10
Show Gist options
  • Select an option

  • Save jcbozonier/229409 to your computer and use it in GitHub Desktop.

Select an option

Save jcbozonier/229409 to your computer and use it in GitHub Desktop.
describe "When building a three pattern with a match any multiple in the middle" do
before(:each) do
@state_builder = StateBuilder.new
@string_reader = StringReader.new("a*.")
@graph = @state_builder.create_from(@string_reader)
end
it "should return a five state graph" do
@graph.transitions[0].destination.transitions[0].destination.transitions[0].destination.transitions[0].destination.should_not == nil
end
it "should start with a start state" do
@graph.class.should == StartState
end
it "should have a standard state as the 2nd state" do
@graph.transitions[0].destination.class.should == StandardState
end
it "should have a standard state as the 3rd state" do
@graph.transitions[0].destination.transitions[0].destination.class.should == StandardState
end
it "should have a standard state as the 4th state" do
@graph.transitions[0].destination.transitions[0].destination.transitions[0].destination.class.should == StandardState
end
it "should have a terminal state as the 5th state" do
@graph.transitions[0].destination.transitions[0].destination.transitions[1].destination.transitions[0].destination.class.should == TerminalState
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment