Skip to content

Commit

Permalink
Merge c7bb59a into faa625e
Browse files Browse the repository at this point in the history
  • Loading branch information
lpradovera committed Mar 14, 2017
2 parents faa625e + c7bb59a commit d377a0b
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions spec/ruby_speech/grxml/matcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,41 @@ module GRXML
end
end

context "with a grammar that takes a double digit and a single digit that is a partial match" do
let(:grammar) do
GRXML.draw :mode => :dtmf, :root => 'digits' do
rule :id => 'digits' do
one_of do
item { '6' }
item { '6 7' }
end
end
end
end

it "should maximally match '6 7'" do
expected_match = GRXML::MaxMatch.new :mode => :dtmf,
:confidence => 1,
:utterance => '67',
:interpretation => 'dtmf-6 dtmf-7'
subject.match('67').should == expected_match
end

it "should match '6'" do
expected_match = GRXML::Match.new :mode => :dtmf,
:confidence => 1,
:utterance => '6',
:interpretation => 'dtmf-6'
subject.match('6').should == expected_match
end

%w{* # 1 2 3 4 5 8 9 10 66 26 61}.each do |input|
it "should not match '#{input}'" do
subject.match(input).should == GRXML::NoMatch.new
end
end
end

context "with a grammar that takes a double digit alternative" do
let(:grammar) do
GRXML.draw :mode => :dtmf, :root => 'digits' do
Expand Down

0 comments on commit d377a0b

Please sign in to comment.