<commit_before>require 'simplecov'
require 'coveralls'

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
  SimpleCov::Formatter::HTMLFormatter,
  Coveralls::SimpleCov::Formatter
]

SimpleCov.start do
  add_filter 'test'
  project_name 'Bzip2::FFI'
end

require 'bzip2/ffi'
require 'fileutils'
require 'minitest/autorun'
require 'open3'

module TestHelper
  BASE_DIR = File.expand_path(File.dirname(__FILE__))

  module Assertions
    def assert_files_identical(exp, act, msg = nil)
      msg = message(msg) { "Expected file #{act} to be identical to #{exp}" }
      assert(FileUtils.identical?(exp, act), msg)
    end

    def assert_bzip2_successful(file)
      assert_bzip2_command_successful(path_separators_for_command(file))
    end

    def assert_bunzip2_successful(file)
      assert_bzip2_command_successful('--decompress', path_separators_for_command(file))
    end

    private
<commit_msg>Disable coverage tests on jruby.<commit_after>unless RUBY_ENGINE == 'jruby'
  require 'simplecov'
  require 'coveralls'

  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
    SimpleCov::Formatter::HTMLFormatter,
    Coveralls::SimpleCov::Formatter
  ]

  SimpleCov.start do
    add_filter 'test'
    project_name 'Bzip2::FFI'
  end
end

require 'bzip2/ffi'
require 'fileutils'
require 'minitest/autorun'
require 'open3'

module TestHelper
  BASE_DIR = File.expand_path(File.dirname(__FILE__))

  module Assertions
    def assert_files_identical(exp, act, msg = nil)
      msg = message(msg) { "Expected file #{act} to be identical to #{exp}" }
      assert(FileUtils.identical?(exp, act), msg)
    end

    def assert_bzip2_successful(file)
      assert_bzip2_command_successful(path_separators_for_command(file))
    end

    def assert_bunzip2_successful(file)
      assert_bzip2_command_successful('--decompress', path_separators_for_command(file))
    end

    private

{'fraction_non_alphanumeric': 0.09857670005271481, 'fraction_numerical': 0.007380073800738007, 'mean_word_length': 4.876160990712075, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '310220', 'n_tokens_mistral': 641, 'n_tokens_neox': 633, 'n_words': 124}