benchmark
benchmark copied to clipboard
Bugfix for Tms#add! not updating @total
Because the total instance variable only updates in initialize, it does not reflect the correct value when add! is called. This fixes the problem.
A test case is provided to show the bug/fix.
A more robust solution would be to use a total method instead to return the calculated value. It may be worth checking if such a solution is generally faster than doing the calculation every time a Tms object is created/updated. Benchmark the benchmarking! :-)