<commit_before>require 'helper'

class TestTopN < Minitest::Test
  def test_creation_without_arguments
    topn = TopN.new
    assert topn
    assert topn.maxsize > 0
  end

  def test_creation_with_maxsize
    topn = TopN.new(maxsize: 100)
    assert topn.maxsize == 100
  end

  def test_creation_with_direction
    topn = TopN.new(direction: :bottom)
    assert topn.direction == :bottom
  end

  def test_creation_raises_assertion_with_bad_direction
    assert_raises(ArgumentError) {
      TopN.new(direction: :flarg)
    }
  end
end<commit_msg>add more tests to detect bad options<commit_after>require 'helper'

class TestTopN < Minitest::Test
  def test_creation_without_arguments
    topn = TopN.new
    assert topn
  end

  def test_creation_without_arguments_sets_maxsize_to_some_positive_default
    topn = TopN.new
    assert topn.maxsize > 0
  end

  def test_creation_with_maxsize
    topn = TopN.new(maxsize: 100)
    assert topn.maxsize == 100
  end

  def test_creation_with_direction
    topn = TopN.new(direction: :bottom)
    assert topn.direction == :bottom
  end

  def test_creation_raises_assertion_with_bad_direction
    assert_raises(ArgumentError) {
      TopN.new(direction: :flarg)
    }
  end

  def test_creation_raises_assertion_with_zero_maxsize
    assert_raises(ArgumentError) {
      TopN.new(maxsize: 0)
    }
  end

  def test_creation_raises_assertion_with_negative_maxsize
    assert_raises(ArgumentError) {
      TopN.new(maxsize: -1)
    }
  end

  def test_creation_raises_assertion_with_non_fixnum_maxsize
    assert_raises(ArgumentError) {
      TopN.new(maxsize: 'foo')
    }
  end
end
{'fraction_non_alphanumeric': 0.06560392397302268, 'fraction_numerical': 0.009809932556713672, 'mean_word_length': 3.7719298245614037, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7422846', 'n_tokens_mistral': 605, 'n_tokens_neox': 566, 'n_words': 108}