# frozen_string_literal: true

RSpec.describe ListMath::Base do
  describe '#Base' do
    it { expect(described_class.new('', '', []).call).to eq 0 }
    it { expect(described_class.new('0x0', '0x', %w[0 1]).call).to eq 0 }
    it { expect(described_class.new('0x1', '0x', %w[0 1]).call).to eq 1 }
    it { expect(described_class.new('0x2', '0x', %w[0 1]).call).to eq 0 }
    it { expect(described_class.new('0xA', '0x', %w[A B]).call).to eq 0 }
    it { expect(described_class.new('0xB', '0x', %w[A B]).call).to eq 1 }
    it { expect(described_class.new('0xb', '0x', %w[A B]).call).to eq 1 }
    it { expect(described_class.new('0xb', '0x', %w[A b]).call).to eq 1 }
    it { expect(described_class.new('11', '', %w[0 1 2 3 4 5 6 7 8 9]).call).to eq 11 }
    it { expect(described_class.new('11', '', %w[0 1 2 3 4 5 6 7]).call).to eq 9 }
  end
end
