Sha256: cf8ca007e27cc4a8df500ceae80ef41f786000ff3b75921a7c6b0c16cc99a177
Contents?: true
Size: 1.37 KB
Versions: 3
Compression:
Stored size: 1.37 KB
Contents
require 'spec_helper' describe 'integration of negative' do describe 'with a addition' do subject do Danica::Wrapper::Negative.new( Danica::Operator::Addition.new(1,2,3) ) end describe '#to_gnu' do it 'returns the correct string' do expect(subject.to_gnu).to eq('-(1 + 2 + 3)') end end describe '#to_tex' do it 'returns the correct string' do expect(subject.to_tex).to eq('-\left(1 + 2 + 3\right)') end end describe 'when it is the result of an expression' do let(:x) { Danica::Wrapper::Variable.new(:x) } let(:y) { Danica::Wrapper::Variable.new(:y) } let(:z) { Danica::Wrapper::Variable.new(:z) } let(:negative_parcel) { y + z } subject do x - negative_parcel end it 'wraps parcel into a group' do expect(subject.to_gnu).to eq('x -(y + z)') end context 'when the negative parcel is an expression' do let(:negative_parcel) { Danica.build(:y, :z) { y + z } } it 'wraps parcel into a group' do expect(subject.to_gnu).to eq('x -(y + z)') end context 'when negative has just one element' do let(:negative_parcel) { Danica.build(:y) { y } } it 'wraps parcel into a group' do expect(subject.to_gnu).to eq('x -y') end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
danica-2.7.4 | spec/integration/negative_spec.rb |
danica-2.7.3 | spec/integration/negative_spec.rb |
danica-2.7.2 | spec/integration/negative_spec.rb |