<commit_before>require 'spec_helper'

describe UserFriendlyId do
  subject { UserFriendlyId.new }

  describe '#to_base34' do
    context 'method existence' do
      it 'is callable on any Integer' do
        expect(Integer(45)).to respond_to :to_base34
        expect(45).to respond_to :to_base34
        expect(456789012345678901234567).to respond_to :to_base34
      end
    end

    context 'correct conversion' do
      it 'handles 0 just fine' do
        expect(0.to_base34).to eq "0"
      end

      it 'handles powers of 34 as expected' do
        expect((34 ** 1).to_base34).to eq "10"
        expect((34 ** 5).to_base34).to eq "100000"
        expect((34 ** 10).to_base34).to eq "10000000000"
      end
    end
  end

  describe '#from_base34' do
  end
end<commit_msg>adding specs for negative integers<commit_after>require 'spec_helper'

describe UserFriendlyId do
  subject { UserFriendlyId.new }

  describe '#to_base34' do
    context 'method existence' do
      it 'is callable on any Integer' do
        expect(Integer(45)).to respond_to :to_base34
        expect(45).to respond_to :to_base34
        expect(456789012345678901234567).to respond_to :to_base34
      end
    end

    context 'correct conversion' do
      it 'handles 0 just fine' do
        expect(0.to_base34).to eq "0"
      end

      it 'handles powers of 34 as expected' do
        expect((34 ** 1).to_base34).to eq "10"
        expect((34 ** 5).to_base34).to eq "100000"
        expect((34 ** 10).to_base34).to eq "10000000000"
      end

      it 'handles negative integer as expected' do
        expect((-34 ** 1).to_base34).to eq "-10"
        expect((-34 ** 5).to_base34).to eq "-100000"
        expect((-34 ** 10).to_base34).to eq "-10000000000"
      end
    end
  end

  describe '#from_base34' do
  end
end
{'fraction_non_alphanumeric': 0.10321864594894561, 'fraction_numerical': 0.10821309655937847, 'mean_word_length': 2.584493041749503, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 3, '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': '1529102', 'n_tokens_mistral': 726, 'n_tokens_neox': 586, 'n_words': 171}