<commit_before>require 'calculator/string_calculator'

def tokenizer(test)
  tokenizer = instance_double('Tokenizer')
  allow(tokenizer).to receive(:ints) { test[:ints] }
  expect(tokenizer).to receive(:ints).with(test[:string])
  tokenizer
end

describe 'StringCalculator' do

  it 'should have a default value' do
    expect(StringCalculator.new.value).to eq(0)
    expect(StringCalculator.new(0).value).to eq(0)
    expect(StringCalculator.new(10).value).to eq(10)
  end

  context 'add' do
    it 'should add' do
      [{
           :initial_value => 0,
           :string => '10',
           :ints => [10],
           :result => 10
       },
       {
           :initial_value => 10,
           :string => '10',
           :ints => [10],
           :result => 20
       },
       {
           :initial_value => 0,
           :string => '10',
           :ints => [10],
           :result => 20
       }
      ].each { |test|<commit_msg>fixing requires in calculator spec<commit_after>require 'calculator/string_calculator'
require 'tokenizer/tokenizer'

def tokenizer(test)
  tokenizer = instance_double('Tokenizer')
  allow(tokenizer).to receive(:ints) { test[:ints] }
  expect(tokenizer).to receive(:ints).with(test[:string])
  tokenizer
end

describe 'StringCalculator' do

  it 'should have a default value' do
    expect(StringCalculator.new.value).to eq(0)
    expect(StringCalculator.new(0).value).to eq(0)
    expect(StringCalculator.new(10).value).to eq(10)
  end

  context 'add' do
    it 'should add' do
      [{
           :initial_value => 0,
           :string => '10',
           :ints => [10],
           :result => 10
       },
       {
           :initial_value => 10,
           :string => '10',
           :ints => [10],
           :result => 20
       },
       {
           :initial_value => 10,
           :string => '0',
           :ints => [0],
           :result => 10
       }
      ].each { |test|
{'fraction_non_alphanumeric': 0.1466321243523316, 'fraction_numerical': 0.029533678756476684, 'mean_word_length': 2.0650793650793653, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5089297', 'n_tokens_mistral': 665, 'n_tokens_neox': 597, 'n_words': 131}