<commit_before>require 'spec_helper'

describe DParallel do
  describe '#new' do
    describe 'if arguments are valid' do
      subject { described_class.new([1,2,3], 3) }

      it { should be_instance_of DParallel }
    end
  end

  describe '#map' do
    describe 'when square elements in block' do
      subject { d_parallel.map{|x| x*2 } }
      let(:d_parallel) { described_class.new([1,2,3], 3) }

      it { should be_instance_of Array }

      it 'elements should be square' do
        should == [2, 4, 6]
      end
    end

    describe 'when enum object is large' do
      subject { d_parallel.map{|x| x } }
      let(:d_parallel) { described_class.new((1..100).to_a, 2) }

      it { should be_instance_of Array }

      it 'elements should be square' do
        should == (1..100).to_a
      end
    end
  end

  describe '#create_process' do
    subject { d_parallel.send(:create_process) {|x| x} }
    let(:d_parallel) { described_class.new([1,2,3], 3) }

    it 'should return Array' do
      d_parallel.stub(:fork_process)
      should be_instance_of Array
    end
<commit_msg>* Fix description<commit_after>require 'spec_helper'

describe DParallel do
  describe '#new' do
    describe 'if arguments are valid' do
      subject { described_class.new([1,2,3], 3) }

      it { should be_instance_of DParallel }
    end
  end

  describe '#map' do
    describe 'when square elements in block' do
      subject { d_parallel.map{|x| x*2 } }
      let(:d_parallel) { described_class.new([1,2,3], 3) }

      it { should be_instance_of Array }

      it 'elements should be squared' do
        should == [2, 4, 6]
      end
    end

    describe 'when enum object is large' do
      subject { d_parallel.map{|x| x } }
      let(:d_parallel) { described_class.new((1..100).to_a, 2) }

      it { should be_instance_of Array }

      it 'elements should be squared' do
        should == (1..100).to_a
      end
    end
  end

  describe '#create_process' do
    subject { d_parallel.send(:create_process) {|x| x} }
    let(:d_parallel) { described_class.new([1,2,3], 3) }

    it 'should return Array' do
      d_parallel.stub(:fork_process)
      should be_instance_of Array
    end

{'fraction_non_alphanumeric': 0.11349134001823154, 'fraction_numerical': 0.022789425706472195, 'mean_word_length': 2.628099173553719, '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': '2823034', 'n_tokens_mistral': 763, 'n_tokens_neox': 720, 'n_words': 208}