<commit_before>require 'spec_helper'

module TimeScales

  context do
    let( :_59_and_a_half ) {
      Rational( 119, 2 )
    }

    describe Parts::YearOfScheme do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the year component from the given time" do
          expect( subject & Time.new(2010,  1,  1,  0,  0,   0            ) ).to eq( 2010 )
          expect( subject & Time.new(2012, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 2012 )
        end
      end
    end

    describe Parts::QuarterOfYear do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the quarter part value from the given time" do
          expect( subject & Time.new(2010,  1,  1,  0,  0,   0            ) ).to eq( 1 )
          expect( subject & Time.new(2010,  5, 16,  0,  0,   0            ) ).to eq( 2 )
          expect( subject & Time.new(2012, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 4 )
        end
      end
    end

    describe Parts::MonthOfYear do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the month component from the given time" do
          expect( subject & Time.new(2010,  1,  1,  0,  0,   0            ) ).to eq(  1 )
          expect( subject & Time.new(2010,  5, 16,  0,  0,   0            ) ).to eq(  5 )
          expect( subject & Time.new(2012, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 12 )
        end
      end
    end

    describe Parts::MonthOfQuarter do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the month-of-quarter value from the given time" do
          expect( subject & Time.new(2010,  1,  1,  0,  0,   0            ) ).to eq( 1 )
          expect( subject & Time.new(2010,  5, 16,  0,  0,   0            ) ).to eq( 2 )
          expect( subject & Time.new(2012, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 3 )
        end
      end
    end

    describe Parts::DayOfMonth do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the day component from the given time" do
          expect( subject & Time.new(2010,  1,  1,  0,  0,   0            ) ).to eq(  1 )
          expect( subject & Time.new(2010,  5, 16,  0,  0,   0            ) ).to eq( 16 )
          expect( subject & Time.new(2012, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 31 )
        end
      end
    end

    describe Parts::DayOfYear do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the day-of-year value from the given time" do
          expect( subject & Time.new(1998,  4,  1,  0,  0,   0            ) ).to eq(  91 )
          expect( subject & Time.new(2000,  4,  1,  0,  0,   0            ) ).to eq(  92 )
          expect( subject & Time.new(1998, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 365 )
          expect( subject & Time.new(2000, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 366 )
        end
      end
    end

    describe Parts::DayOfQuarter do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the day-of-quarter value from the given time" do
          expect( subject & Time.new(1998,  2, 14,  0,  0,   0            ) ).to eq( 45 )
          expect( subject & Time.new(1998,  4,  1,  0,  0,   0            ) ).to eq(  1 )
          expect( subject & Time.new(2000,  4,  1,  0,  0,   0            ) ).to eq(  1 )
          expect( subject & Time.new(2000, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 92 )
        end
      end
    end

  end

end
<commit_msg>Add missing spec coverage for HourOfDay<commit_after>require 'spec_helper'

module TimeScales

  context do
    let( :_59_and_a_half ) {
      Rational( 119, 2 )
    }

    describe Parts::YearOfScheme do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the year component from the given time" do
          expect( subject & Time.new(2010,  1,  1,  0,  0,   0            ) ).to eq( 2010 )
          expect( subject & Time.new(2012, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 2012 )
        end
      end
    end

    describe Parts::QuarterOfYear do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the quarter part value from the given time" do
          expect( subject & Time.new(2010,  1,  1,  0,  0,   0            ) ).to eq( 1 )
          expect( subject & Time.new(2010,  5, 16,  0,  0,   0            ) ).to eq( 2 )
          expect( subject & Time.new(2012, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 4 )
        end
      end
    end

    describe Parts::MonthOfYear do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the month component from the given time" do
          expect( subject & Time.new(2010,  1,  1,  0,  0,   0            ) ).to eq(  1 )
          expect( subject & Time.new(2010,  5, 16,  0,  0,   0            ) ).to eq(  5 )
          expect( subject & Time.new(2012, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 12 )
        end
      end
    end

    describe Parts::MonthOfQuarter do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the month-of-quarter value from the given time" do
          expect( subject & Time.new(2010,  1,  1,  0,  0,   0            ) ).to eq( 1 )
          expect( subject & Time.new(2010,  5, 16,  0,  0,   0            ) ).to eq( 2 )
          expect( subject & Time.new(2012, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 3 )
        end
      end
    end

    describe Parts::DayOfMonth do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the day component from the given time" do
          expect( subject & Time.new(2010,  1,  1,  0,  0,   0            ) ).to eq(  1 )
          expect( subject & Time.new(2010,  5, 16,  0,  0,   0            ) ).to eq( 16 )
          expect( subject & Time.new(2012, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 31 )
        end
      end
    end

    describe Parts::DayOfYear do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the day-of-year value from the given time" do
          expect( subject & Time.new(1998,  4,  1,  0,  0,   0            ) ).to eq(  91 )
          expect( subject & Time.new(2000,  4,  1,  0,  0,   0            ) ).to eq(  92 )
          expect( subject & Time.new(1998, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 365 )
          expect( subject & Time.new(2000, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 366 )
        end
      end
    end

    describe Parts::DayOfQuarter do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the day-of-quarter value from the given time" do
          expect( subject & Time.new(1998,  2, 14,  0,  0,   0            ) ).to eq( 45 )
          expect( subject & Time.new(1998,  4,  1,  0,  0,   0            ) ).to eq(  1 )
          expect( subject & Time.new(2000,  4,  1,  0,  0,   0            ) ).to eq(  1 )
          expect( subject & Time.new(2000, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 92 )
        end
      end
    end

    describe Parts::HourOfDay do
      it "is included in the Parts::all collection" do
        expect( Parts.all ).to include( subject )
      end

      describe '#&' do
        it "Extracts the hour component from the given time" do
          expect( subject & Time.new(2010,  1,  1,  0,  0,   0            ) ).to eq(  0 )
          expect( subject & Time.new(2010,  5, 16, 13,  0,   0            ) ).to eq( 13 )
          expect( subject & Time.new(2012, 12, 31, 23, 59, _59_and_a_half ) ).to eq( 23 )
        end
      end
    end

  end

end

{'fraction_non_alphanumeric': 0.11166339151543174, 'fraction_numerical': 0.07109004739336493, 'mean_word_length': 1.667900092506938, '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': 66, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5262043', 'n_tokens_mistral': 3305, 'n_tokens_neox': 2839, 'n_words': 1030}