<commit_before>$:.unshift File.expand_path("../ext", __FILE__)
require 'test/unit'
require 'hash'

class TestHash < Test::Unit::TestCase

  def test_that_it_sorts_strings
    orig = {
      'zoo' => 1,
      'apple' => 2,
      'pizza' => 3
    }

    sorted = orig.sort_by_key
    assert_equal sorted.keys, ['apple', 'pizza', 'zoo']
  end

  def test_that_it_sorts_integers
    orig = {
      4 => 1,
      1 => 2,
      3 => 3
    }

    sorted = orig.sort_by_key
    assert_equal sorted.keys, [1, 3, 4]
  end

  def test_that_it_sorts_special_chars
    orig = {
      'aaa' => 1,
      '~ccc' => 2,
      'zzz' => 3
    }

    sorted = orig.sort_by_key
    assert_equal sorted.keys, ['aaa', 'zzz', '~ccc']
  end

  def test_that_it_sorts_nested_hashes
    orig = {
      :b => 5,
      :a => {
        'bbb' => 1,
        'aaa' => 9
      }
    }

    sorted = orig.sort_by_key
    assert_equal [:a, :b], sorted.keys
    assert_equal ['aaa', 'bbb'], sorted[:a].keys
  end

  # This is not currently supported, so might as well verify the expected behavior
  def test_that_hashes_inside_an_array_are_not_sorted
    orig = {
      :b => 5,
      :a => [{
        'bbb' => 1,
        'aaa' => 9
      }]
    }

    sorted = orig.sort_by_key
    assert_equal [:a, :b], sorted.keys
    assert_equal ['bbb', 'aaa'], sorted[:a].first.keys
  end

end<commit_msg>Try to fix test load path<commit_after>$:.unshift File.expand_path("../../ext", __FILE__)
require 'test/unit'
require 'hash'

class TestHash < Test::Unit::TestCase

  def test_that_it_sorts_strings
    puts $LOAD_PATH
    orig = {
      'zoo' => 1,
      'apple' => 2,
      'pizza' => 3
    }

    sorted = orig.sort_by_key
    assert_equal sorted.keys, ['apple', 'pizza', 'zoo']
  end

  def test_that_it_sorts_integers
    orig = {
      4 => 1,
      1 => 2,
      3 => 3
    }

    sorted = orig.sort_by_key
    assert_equal sorted.keys, [1, 3, 4]
  end

  def test_that_it_sorts_special_chars
    orig = {
      'aaa' => 1,
      '~ccc' => 2,
      'zzz' => 3
    }

    sorted = orig.sort_by_key
    assert_equal sorted.keys, ['aaa', 'zzz', '~ccc']
  end

  def test_that_it_sorts_nested_hashes
    orig = {
      :b => 5,
      :a => {
        'bbb' => 1,
        'aaa' => 9
      }
    }

    sorted = orig.sort_by_key
    assert_equal [:a, :b], sorted.keys
    assert_equal ['aaa', 'bbb'], sorted[:a].keys
  end

  # This is not currently supported, so might as well verify the expected behavior
  def test_that_hashes_inside_an_array_are_not_sorted
    orig = {
      :b => 5,
      :a => [{
        'bbb' => 1,
        'aaa' => 9
      }]
    }

    sorted = orig.sort_by_key
    assert_equal [:a, :b], sorted.keys
    assert_equal ['bbb', 'aaa'], sorted[:a].first.keys
  end

end
{'fraction_non_alphanumeric': 0.1447799199708985, 'fraction_numerical': 0.015278283012004365, 'mean_word_length': 2.20139697322468, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, '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': '5786356', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1043, 'n_words': 240}