Test-First-Teaching performance_monitorを構築していて、5番目のテストに到達できますが、失敗します。
ブロックが1回だけ実行されるのはなぜですか?
これは私のコードです:
require "time"
t = Time.now
def measure x=0
start = Time.now
yield x
endt = Time.now - start
end
measure(4){ |x| x.times do Time.now - t end}
これはエラーです:
*Error____
Performance Monitor
takes about 0 seconds to run an empty block
takes exactly 0 seconds to run an empty block (with stubs)
takes about 1 second to run a block that sleeps for 1 second
takes exactly 1 second to run a block that sleeps for 1 second (with stubs)
runs a block N times (FAILED - 1)
Failures:
1) Performance Monitor runs a block N times
Failure/Error: n.should == 4
expected: 4
got: 1 (using ==)