test/zold/stress/test_stats.rb in zold-stress-0.2.0 vs test/zold/stress/test_stats.rb in zold-stress-0.3.0
- old
+ new
@@ -31,6 +31,15 @@
stats.put(m, 0.1)
stats.put(m, 3.0)
assert(stats.to_json[m])
assert_equal(1.55, stats.to_json[m][:avg])
end
+
+ def test_works_with_empty
+ stats = Zold::Stress::Stats.new
+ m = 'metric-2'
+ assert(!stats.exists?(m))
+ assert_equal(0, stats.sum(m))
+ assert_equal(0, stats.avg(m))
+ assert_equal(0, stats.total(m))
+ end
end