<commit_before># encoding: UTF-8

require 'formula'

class Bsdconv < Formula
  homepage 'https://github.com/buganini/bsdconv'
  url 'https://github.com/buganini/bsdconv/tarball/9.1'
  sha1 '282fa6f2bcb6ef3b73f19ef269ecc917edcde729'

  head 'https://github.com/buganini/bsdconv.git'

  def install
    system "make", "PREFIX=#{prefix}"
    system "make", "PREFIX=#{prefix}", "install"
  end

  def test
    printf = 'printf "\263\134\245\134\273\134"'
    system "test `#{printf} | #{bin}/bsdconv big5:utf-8` = '許功蓋'"
  end
end<commit_msg>bsdconv: improve test<commit_after># encoding: UTF-8

require 'formula'

class Bsdconv < Formula
  homepage 'https://github.com/buganini/bsdconv'
  url 'https://github.com/buganini/bsdconv/tarball/9.1'
  sha1 '282fa6f2bcb6ef3b73f19ef269ecc917edcde729'

  head 'https://github.com/buganini/bsdconv.git'

  def install
    system "make", "PREFIX=#{prefix}"
    system "make", "PREFIX=#{prefix}", "install"
  end

  test do
    require 'open3'
    Open3.popen3("#{bin}/bsdconv", "big5:utf-8") do |stdin, stdout, _|
      stdin.write("\263\134\245\134\273\134")
      stdin.close
      stdout.read == "許功蓋"
    end
  end
end
{'fraction_non_alphanumeric': 0.16062176165803108, 'fraction_numerical': 0.07858376511226252, 'mean_word_length': 3.730612244897959, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 6, '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': '1848169', 'n_tokens_mistral': 522, 'n_tokens_neox': 463, 'n_words': 82}