Sha256: 2606b3fbc91458f006a9d605d07408165eda71fd0c1311868022b0db248c9115

Contents?: true

Size: 792 Bytes

Versions: 5

Compression:

Stored size: 792 Bytes

Contents

require(File.dirname(__FILE__)+'/test_helpers.rb')



class StatsampleHistogramTestCase < MiniTest::Unit::TestCase
  def test_control
    h = Statsample::Histogram.alloc(4)
    assert_equal([0.0]*4, h.bin)
    assert_equal([0.0]*5, h.range)
    h = Statsample::Histogram.alloc([1, 3, 7, 9, 20])
    assert_equal([0.0]*4, h.bin)
    assert_equal([1,3,7,9,20], h.range)
    h = Statsample::Histogram.alloc(5, [0, 5])
    assert_equal([0.0,1.0,2.0,3.0,4.0,5.0], h.range)
    assert_equal([0.0]*5,h.bin)
    h.increment(2.5)
    assert_equal([0.0,0.0,1.0,0.0,0.0], h.bin)
    h.increment([0.5,0.5,3.5,3.5])
    assert_equal([2.0,0.0,1.0,2.0,0.0], h.bin)
    h.increment(0)
    assert_equal([3.0,0.0,1.0,2.0,0.0], h.bin)
    h.increment(5)
    assert_equal([3.0,0.0,1.0,2.0,0.0], h.bin)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
statsample-0.10.0 test/test_histogram.rb
statsample-0.9.0 test/test_histogram.rb
statsample-0.8.2 test/test_histogram.rb
statsample-0.8.1 test/test_histogram.rb
statsample-0.8.0 test/test_histogram.rb