Sha256: 815e70708a2afa627433ff64c8d26f360851989cd2483cad9abbbfce5411b736

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Danica::Operator::Multiplication do
  subject { described_class.new(2, 4) }

  it 'initializes from array' do
    expect do
      described_class.new(10, 2)
    end.not_to raise_error
  end

  it_behaves_like 'an object that respond to basic_methods'

  it_behaves_like 'an object with * operation' do
    context 'when other is also a multiplication' do
      let(:other) { described_class.new(200, 5) }

      it 'includes the addition parcels in the result' do
        expect(result.to_gnu).to eq('2 * 4 * 200 * 5')
      end
    end
  end
  it_behaves_like 'an object with basic operation', ignore: :*

  it_behaves_like 'a operator that joins many variables with same operation',
                  calculated: 24,
                  numeric_variables: [1.5, 2, 3.5],
                  tex: {
                    string_expected: %w[X1 X2 X3 X4].join(' \cdot '),
                    integer_expected: %w[1.5 2 X3 X4].join(' \cdot '),
                    float_expected: %w[1.5 2 3.5 X4].join(' \cdot ')
                  },
                  gnu: {
                    string_expected: %w[X1 X2 X3 X4].join(' * '),
                    integer_expected: %w[1.5 2 X3 X4].join(' * '),
                    float_expected: %w[1.5 2 3.5 X4].join(' * ')
                  }
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
danica-2.7.7 spec/lib/danica/operator/multiplication_spec.rb
danica-2.7.6 spec/lib/danica/operator/multiplication_spec.rb
danica-2.7.5 spec/lib/danica/operator/multiplication_spec.rb