diff options
author | tiendo1011 <tiendo1011@gmail.com> | 2021-12-19 16:44:38 +0700 |
---|---|---|
committer | tiendo1011 <tiendo1011@gmail.com> | 2021-12-19 16:49:28 +0700 |
commit | eb5b8cb8b5622915aa43fb1d50f9feba7bf2f5f4 (patch) | |
tree | b14bfa787056072b3568cdad0e562c3c7c0b70d8 /spec | |
parent | cd4b76d53d77fa596d72584d7531fdb811cd38bf (diff) | |
download | diff-lcs-eb5b8cb8b5622915aa43fb1d50f9feba7bf2f5f4.tar.gz |
Fix off-by-one error
in ruby, (0..matches.size) will include both sides in the range, which
means we'll get off-by-one error
Diffstat (limited to 'spec')
-rw-r--r-- | spec/traverse_sequences_spec.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/spec/traverse_sequences_spec.rb b/spec/traverse_sequences_spec.rb index ea7a129..b185e1d 100644 --- a/spec/traverse_sequences_spec.rb +++ b/spec/traverse_sequences_spec.rb @@ -127,13 +127,11 @@ describe 'Diff::LCS.traverse_sequences' do end it 'has done markers differently-sized sequences' do - expect(@callback_s1_s2.done_a).to eq([['p', 9, 's', 10]]) + expect(@callback_s1_s2.done_a).to eq([['p', 9, 't', 11]]) expect(@callback_s1_s2.done_b).to be_empty - # 20110731 I don't yet understand why this particular behaviour - # isn't transitive. expect(@callback_s2_s1.done_a).to be_empty - expect(@callback_s2_s1.done_b).to be_empty + expect(@callback_s2_s1.done_b).to eq([['t', 11, 'p', 9]]) end end end |