Sha256: fea2d273b10811229541ac0bbceef0262cf0c2d892975078d15ef41e819437b9

Contents?: true

Size: 793 Bytes

Versions: 11

Compression:

Stored size: 793 Bytes

Contents

require(File.dirname(__FILE__)+'/helpers_tests.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

11 entries across 11 versions & 1 rubygems

Version Path
statsample-0.16.0 test/test_histogram.rb
statsample-0.15.1 test/test_histogram.rb
statsample-0.15.0 test/test_histogram.rb
statsample-0.14.1 test/test_histogram.rb
statsample-0.14.0 test/test_histogram.rb
statsample-0.13.1 test/test_histogram.rb
statsample-0.13.0 test/test_histogram.rb
statsample-0.12.0 test/test_histogram.rb
statsample-0.11.2 test/test_histogram.rb
statsample-0.11.1 test/test_histogram.rb
statsample-0.11.0 test/test_histogram.rb