我正在尝试使用我用于在输出中开发函数的示例来加速我的测试开发.
我有两个数组:输入和输出.
function(input[0]) == output[0].
循环正在运行,但它会卡在最后一个索引中.例如:如果input.length = 10,它总是执行功能(输入[10])==输出[10].
describe "multiple_chords" do
input = ["A7 DMaj79", "E-7 A7", "D-7 G7", "Bb-7b5 Eb7b9" , "Bb-7b5 Eb7", "G7 A7", "D-7b5 G7b9", "D-79 G#7913"]
output = [[{"root"=>"A", "def"=>"7"}, {"root"=>"D", "def"=>"Maj7"}], [{"root"=>"E", "def"=>"-7"}, {"root"=>"A", "def"=>"7"}], [{"root"=>"D", "def"=>"-7"}, {"root"=>"G", "def"=>"7"}], [{"root"=>"Bb", "def"=>"-7b5"}, {"root"=>"Eb", "tensions"=>"b9", "def"=>"7"}], [{"root"=>"Bb", "def"=>"-7b5"}, {"root"=>"Eb", "def"=>"7"}], [{"root"=>"G", "def"=>"7"}, {"root"=>"A", "def"=>"7"}], [{"root"=>"D", "def"=>"-7b5"}, {"root"=>"G", "tensions"=>"b9", "def"=>"7"}], [{"root"=>"D", "tensions"=>"9", "def"=>"-7"}, {"root"=>"G#", "tensions"=>["9", "13"], "def"=>"7"}]]
for i in 0..input.length-1
it "analyzes correctly #{input[i]}" do
expect(IpmChords::multiple_chords(input[i])).to …Run Code Online (Sandbox Code Playgroud)