Sha256: 6c8ebf58c87be216bd574ec860b8f233e946de7de441c5973cad4cec7f812d72
Contents?: true
Size: 1.57 KB
Versions: 3
Compression:
Stored size: 1.57 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe Danica::Operator::Division do subject { described_class.new(*variables) } let(:variables) { [2, 4] } describe '#numerator' do it 'returns the numerator' do expect(subject.numerator).to eq(Danica::Wrapper::Number.new(2)) end end describe '#denominator' do it 'returns the denominator' do expect(subject.denominator).to eq(Danica::Wrapper::Number.new(4)) end end it_behaves_like 'an object that respond to basic_methods' it_behaves_like 'an object with basic operation' it_behaves_like 'a operator that has two terms', :division, values: [2, 4], calculated: 1.0 / 2.0, to_tex: { string_expected: '\frac{X1}{X2}', numeric_string_expected: '\frac{2}{4}', partial_string_expected: '\frac{2}{X2}' }, to_gnu: { string_expected: '(X1)/(X2)', numeric_string_expected: '(2)/(4)', partial_string_expected: '(2)/(X2)' } describe 'more complex division' do describe 'of two additions' do subject do described_class.new( Danica::Operator::Addition.new(2, :x), Danica::Operator::Addition.new(3, :y) ) end describe 'to_gnu' do let(:expected) do '(2 + x)/(3 + y)' end it 'groups addition' do expect(subject.to_gnu).to eq(expected) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
danica-2.7.7 | spec/lib/danica/operator/division_spec.rb |
danica-2.7.6 | spec/lib/danica/operator/division_spec.rb |
danica-2.7.5 | spec/lib/danica/operator/division_spec.rb |