<commit_before># Test::Unit emulation layer.
#--
# Copyright protects this work.
# See LICENSE file for details.
#++

require 'dfect'

module Kernel
  def setup &block
    Dfect.<(&block)
  end

  def teardown &block
    Dfect.>(&block)
  end

  [
    [:assert,     nil,  nil   ],
    [:assert_not, '!',  'not '],
  ].
  each do |prefix, polarity, action|
    file, line = __FILE__, __LINE__ ; eval %{
      def #{prefix} boolean, message = nil
        Dfect.T#{polarity}(message) { boolean }
      end

      def #{prefix}_block message = nil, &block
        Dfect.T#{polarity}(&block)
      end

      def #{prefix}_empty collection, message = nil
        message ||= 'collection must #{action}be empty'
        Dfect.T#{polarity}(message) { collection.empty? }
      end

      def #{prefix}_equal actual, expected, message = nil
        message ||= 'actual must #{action}equal expected'
        Dfect.T#{polarity}(message) { actual == expected }
      end

      def #{prefix}_in_delta expected, actual, delta = nil, message = nil
        message ||= 'actual must #{action}be within delta of expected'
        delta   ||= 0.001

        Dfect.T#{polarity}(message) { Math.abs(expected - actual) <= Math.abs(delta) }
      end

      alias #{prefix}_in_epsilon #{prefix}_in_delta

      def #{prefix}_include item, collection, message = nil
        message ||= 'collection must #{action}include item'
        Dfect.T#{polarity}(messsage) { collection.include? item }
      end

      def #{prefix}_instance_of _class, object, message = nil
        message ||= 'object must #{action}be an instance of class'
        Dfect.T#{polarity}(message) { object.instance_of? _class }
      end

      def #{prefix}_kind_of _class, object, message = nil
        message ||= 'object must #{action}be a kind of class'
        Dfect.T#{polarity}(message) { object.kind_of? _class }
      end

      def #{prefix}_nil object, message = nil<commit_msg>assert_equal() params were in the wrong order<commit_after># Test::Unit emulation layer.
#--
# Copyright protects this work.
# See LICENSE file for details.
#++

require 'dfect'

module Kernel
  def setup &block
    Dfect.<(&block)
  end

  def teardown &block
    Dfect.>(&block)
  end

  [
    [:assert,     nil,  nil   ],
    [:assert_not, '!',  'not '],
  ].
  each do |prefix, polarity, action|
    file, line = __FILE__, __LINE__ ; eval %{
      def #{prefix} boolean, message = nil
        Dfect.T#{polarity}(message) { boolean }
      end

      def #{prefix}_block message = nil, &block
        Dfect.T#{polarity}(&block)
      end

      def #{prefix}_empty collection, message = nil
        message ||= 'collection must #{action}be empty'
        Dfect.T#{polarity}(message) { collection.empty? }
      end

      def #{prefix}_equal expected, actual, message = nil
        message ||= 'actual must #{action}equal expected'
        Dfect.T#{polarity}(message) { actual == expected }
      end

      def #{prefix}_in_delta expected, actual, delta = nil, message = nil
        message ||= 'actual must #{action}be within delta of expected'
        delta   ||= 0.001

        Dfect.T#{polarity}(message) { Math.abs(expected - actual) <= Math.abs(delta) }
      end

      alias #{prefix}_in_epsilon #{prefix}_in_delta

      def #{prefix}_include item, collection, message = nil
        message ||= 'collection must #{action}include item'
        Dfect.T#{polarity}(messsage) { collection.include? item }
      end

      def #{prefix}_instance_of _class, object, message = nil
        message ||= 'object must #{action}be an instance of class'
        Dfect.T#{polarity}(message) { object.instance_of? _class }
      end

      def #{prefix}_kind_of _class, object, message = nil
        message ||= 'object must #{action}be a kind of class'
        Dfect.T#{polarity}(message) { object.kind_of? _class }
      end

      def #{prefix}_nil object, message = nil
{'fraction_non_alphanumeric': 0.13043478260869565, 'fraction_numerical': 0.0020460358056265983, 'mean_word_length': 2.721217887725975, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3466417', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1171, 'n_words': 339}