<commit_before>require 'test/unit/autorunner'

require 'rubygems'
gem 'bfts'

$:.each do |dir|
  if dir =~ /bfts.*lib$/ then
    $: << File.expand_path(File.join(dir, '..'))
  end
end

tests = {
  'test_array'       => :TestArray,
  'test_comparable'  => :TestComparable,
  'test_exception'   => :TestException,
  'test_false_class' => :TestFalseClass,
  'test_file_test'   => :TestFileTest,
  'test_hash'        => :TestHash,
  'test_nil_class'   => :TestNilClass,
  'test_range'       => :TestRange,
  'test_string'      => :TestString,
  'test_struct'      => :TestStruct,
  'test_time'        => :TestTime,
  'test_true_class'  => :TestTrueClass,
}

# These tests fail without JIT, so we shouldn't expect them to pass with
# JIT
known_to_fail = [
  'TestFileTest#test_class_blockdev_eh',
  'TestFileTest#test_class_chardev_eh',
  'TestFileTest#test_class_exist_eh',
  'TestFileTest#test_class_exists_eh',
  'TestFileTest#test_class_file_eh',
  'TestFileTest#test_class_setuid_eh',
  'TestFileTest#test_class_size',
  'TestFileTest#test_class_size_eh',
  'TestFileTest#test_class_symlink_eh',
  'TestFileTest#test_class_zero_eh',
  'TestString#test_inspect',
  'TestTime#test_class_now',
  'TestTime#test_initialize',
  'TestTime#test_inspect',
  'TestTime#test_to_s',
]

use_jit = true
if ARGV.include?('--without-jit') then
  use_jit = false
  ARGV.delete('--without-jit')
end

if use_jit then
  require 'ludicrous'

  require 'logger'
  Ludicrous.logger = Logger.new(STDERR)
end

tests.each do |feature, klass_name|
  require feature
  klass = Object.const_get(klass_name)
  klass.instance_methods(false).sort.each do |name|
    full_name = "#{klass}##{name}"
    if known_to_fail.include?(full_name) then
      klass.instance_eval { remove_method(name) }
      next
    end
  end

  if use_jit then
    klass.instance_eval { include Ludicrous::Speed }
  end
end

if __FILE__ == $0 then
  exit Test::Unit::AutoRunner.run #(true)
end

<commit_msg>Updated list of tests known to fail.<commit_after>require 'test/unit/autorunner'

require 'rubygems'
gem 'bfts'

$:.each do |dir|
  if dir =~ /bfts.*lib$/ then
    $: << File.expand_path(File.join(dir, '..'))
  end
end

tests = {
  'test_array'       => :TestArray,
  'test_comparable'  => :TestComparable,
  'test_exception'   => :TestException,
  'test_false_class' => :TestFalseClass,
  # 'test_file_test'   => :TestFileTest,
  'test_hash'        => :TestHash,
  'test_nil_class'   => :TestNilClass,
  'test_range'       => :TestRange,
  'test_string'      => :TestString,
  'test_struct'      => :TestStruct,
  'test_time'        => :TestTime,
  'test_true_class'  => :TestTrueClass,
}

# These tests fail without JIT, so we shouldn't expect them to pass with
# JIT
known_to_fail = [
  'TestArray#test_spaceship',
  'TestString#test_inspect',
  'TestStruct#test_each',
  'TestTime#test_class_now',
  'TestTime#test_initialize',
  'TestTime#test_inspect',
  'TestTime#test_to_s',
]

use_jit = true
if ARGV.include?('--without-jit') then
  use_jit = false
  ARGV.delete('--without-jit')
end

if use_jit then
  require 'ludicrous'

  require 'logger'
  Ludicrous.logger = Logger.new(STDERR)
end

tests.each do |feature, klass_name|
  require feature
  klass = Object.const_get(klass_name)
  klass.instance_methods(true).sort.each do |name|
    full_name = "#{klass}##{name}"
    if known_to_fail.include?(full_name) then
      klass.instance_eval { undef_method(name) }
      next
    end
  end

  if use_jit then
    klass.instance_eval { include Ludicrous::Speed }
  end
end

if __FILE__ == $0 then
  exit Test::Unit::AutoRunner.run #(true)
end


{'fraction_non_alphanumeric': 0.13496251041377394, 'fraction_numerical': 0.0005554012774229381, 'mean_word_length': 4.12375533428165, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 27, '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': '7606965', 'n_tokens_mistral': 1379, 'n_tokens_neox': 1375, 'n_words': 252}