Created
November 18, 2010 15:59
-
-
Save bmaland/705176 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| :q0 => {"R" => :q1}, | |
| :q1 => {"u" => :q2}, | |
| :q2 => {"u" => :q2, "b" => :q3}, | |
| :q3 => {"y" => :q4} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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