Skip to content

Instantly share code, notes, and snippets.

@bmaland
Created November 18, 2010 15:59
Show Gist options
  • Select an option

  • Save bmaland/705176 to your computer and use it in GitHub Desktop.

Select an option

Save bmaland/705176 to your computer and use it in GitHub Desktop.
{
:q0 => {"R" => :q1},
:q1 => {"u" => :q2},
:q2 => {"u" => :q2, "b" => :q3},
:q3 => {"y" => :q4}
}
describe "the Ruby-language" do
before(:each) do
@r = DFSA.new({
:q0 => {"R" => :q1},
:q1 => {"u" => :q2},
:q2 => {"u" => :q2, "b" => :q3},
:q3 => {"y" => :q4}
}, :q0, [:q4])
end
it "should recognize valid sentences" do
@r.should recognize %w(R u b y)
@r.should recognize %w(R u u u u b y)
end
it "should reject invalid sentences" do
@r.should_not recognize %w(r u b y)
@r.should_not recognize %w(R u b)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment