Sha256: 1ad9fe6944d6be17a79a4d7c84fc026e3b633a9204d45a158810f818b5a2df48
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe MyOperator do describe '#to_gnu' do it 'returns the gnu format' do expect(subject.to_gnu).to eq('x**(pi)') end end describe '#to_tex' do it 'returns the tex format' do expect(subject.to_tex).to eq('x^{\pi}') end end describe '#to_f' do subject { described_class.new(x: 2) } it 'returns the result of the operation' do expect(subject.to_f).to eq(2**Math::PI) end end end describe Danica::Operator::Inverse do subject { described_class.new(:x) } describe '#to_tex' do it 'returns the formated tex string' do expect(subject.to_tex).to eq('(x)^{-1}') end end describe '#to_gnu' do it 'returns the formated gnu string' do expect(subject.to_gnu).to eq('(x) ** -1') end end describe '#to_f' do it do expect { subject.to_f }.to raise_error(Danica::Exception::NotDefined) end context 'when value is defined' do subject { described_class.new 2 } it 'returns the calculated value' do expect(subject.to_f).to eq(0.5) end end end describe '#calculate' do it 'returns the calculated value' do expect(subject.calculate(2)).to eq(0.5) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
danica-2.7.7 | spec/integration/readme/operator_spec.rb |
danica-2.7.6 | spec/integration/readme/operator_spec.rb |
danica-2.7.5 | spec/integration/readme/operator_spec.rb |