<commit_before>require 'spec_helper'

describe Muecken::Matcher::Date do

  it 'supports the :day mode' do
    Muecken::Matcher::Date.new(:day).must_be_instance_of Muecken::Matcher::Date
  end

  it 'supports the :month mode' do
    Muecken::Matcher::Date.new(:month)
      .must_be_instance_of Muecken::Matcher::Date
  end

  it 'supports the :year mode' do
    Muecken::Matcher::Date.new(:year).must_be_instance_of Muecken::Matcher::Date
  end

  it 'supports the :weekday mode' do
    Muecken::Matcher::Date.new(:weekday)
      .must_be_instance_of Muecken::Matcher::Date
  end

  it 'fails for unsupported modes' do
    proc { Muecken::Matcher::Date.new(:foobar) }.must_raise ArgumentError
  end

  describe '#match?' do
    let(:date) { Date.parse('2014-10-23') }
    let(:different_date) { Date.parse('1994-04-05') }
    let(:reference_entry) { Muecken::Entry.from_hash(date: date) }
    let(:same_day_entry) { Muecken::Entry.from_hash(date: date.dup) }
    let(:same_month_entry) { Muecken::Entry.from_hash(date: date.next_day) }
    let(:same_year_entry) { Muecken::Entry.from_hash(date: date.next_month) }
    let(:same_weekday_entry) { Muecken::Entry.from_hash(date: date + 7) }
    let(:next_year_entry) { Muecken::Entry.from_hash(date: date.next_year) }
    let(:different_entry) { Muecken::Entry.from_hash(date: different_date ) }
    describe 'in :day mode' do
      let(:matcher) { Muecken::Matcher::Date.new(:day) }<commit_msg>added specs for date matcher<commit_after>require 'spec_helper'

describe Muecken::Matcher::Date do

  it 'supports the :day mode' do
    Muecken::Matcher::Date.new(:day).must_be_instance_of Muecken::Matcher::Date
  end

  it 'supports the :month mode' do
    Muecken::Matcher::Date.new(:month)
      .must_be_instance_of Muecken::Matcher::Date
  end

  it 'supports the :year mode' do
    Muecken::Matcher::Date.new(:year).must_be_instance_of Muecken::Matcher::Date
  end

  it 'supports the :weekday mode' do
    Muecken::Matcher::Date.new(:weekday)
      .must_be_instance_of Muecken::Matcher::Date
  end

  it 'fails for unsupported modes' do
    proc { Muecken::Matcher::Date.new(:foobar) }.must_raise ArgumentError
  end

  describe '#match?' do
    let(:date) { Date.parse('2014-10-23') }
    let(:different_date) { Date.parse('1994-04-05') }
    let(:reference_entry) { Muecken::Entry.from_hash(date: date) }
    let(:same_day_entry) { Muecken::Entry.from_hash(date: date.dup) }
    let(:same_month_entry) { Muecken::Entry.from_hash(date: date.next_day) }
    let(:same_year_entry) { Muecken::Entry.from_hash(date: date.next_month) }
    let(:same_weekday_entry) { Muecken::Entry.from_hash(date: date + 7) }
    let(:next_year_entry) { Muecken::Entry.from_hash(date: date.next_year) }
    let(:different_entry) { Muecken::Entry.from_hash(date: different_date ) }
    let(:matcher) { Muecken::Matcher::Date.new }
    it 'returns false when the first entry does not have a date' do
      matcher.match?(Muecken::Entry.new, reference_entry).must_equal false
    end
    it 'returns false when the second entry does not have a date' do
      matcher.match?(reference_entry, Muecken::Entry.new).must_equal false
    end
    describe 'in :day mode' do
      let(:matcher) { Muecken::Matcher::Date.new(:day) }
{'fraction_non_alphanumeric': 0.1401782969566554, 'fraction_numerical': 0.01045189056255764, 'mean_word_length': 4.649305555555555, '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': '2956158', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1182, 'n_words': 220}