Sha256: 2864464e9f62157ceb676730543e6f25c0d9ee77295d464628caefcbe3c74698

Contents?: true

Size: 639 Bytes

Versions: 2

Compression:

Stored size: 639 Bytes

Contents

require 'helper'

class TestData < Minitest::Test
  def test_data_is_empty_on_create
    topn = TopN.new(maxsize: 2)
    assert_equal({}, topn.data)
  end

  def test_data_has_keys
    topn = TopN.new(maxsize: 2)
    assert topn.add(1, 1), "add(1, 1) failed"
    assert topn.add(2, 2), "add(1, 1) failed"
    assert topn.add(3, 3), "add(1, 1) failed"
    assert_equal [2, 3], topn.data.keys.sort
  end

  def test_keys
    topn = TopN.new(maxsize: 2)
    assert topn.add(1, 1), "add(1, 1) failed"
    assert topn.add(2, 2), "add(1, 1) failed"
    assert topn.add(3, 3), "add(1, 1) failed"
    assert_equal [2, 3], topn.keys.sort
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
top_n-1.0.1 test/test_data.rb
top_n-1.0.0 test/test_data.rb