Sha256: 1593f7209f9ca20cc1e829a5f145252a8b411f55e1495430f5b6b6978c14bd64

Contents?: true

Size: 732 Bytes

Versions: 17

Compression:

Stored size: 732 Bytes

Contents

require 'spec_helper'

describe Dydx::Algebra::Set::E do
  it{ expect(e).to eq(e) }

  describe '#to_s' do
    it{ expect(e.to_s).to eq('e') }
  end

  describe '#differentiate' do
    it{ expect(e.d(:x).to_s).to eq(_(0).to_s) }
    it{ expect((e ^ :x).d(:x).to_s).to eq('( e ^ x )') }
    it{ expect((e ^ (:x + :y)).d(:x).to_s).to eq('( e ^ ( x + y ) )') }
  end

  describe 'Calculate' do
    context 'With Fixnum' do
      it{ expect(e + 0).to eq(e) }
      it{ expect(e - 0).to eq(e) }
      it{ expect((e * 0).to_s).to eq('0') }
      it{ expect(e * 1).to eq(e) }
      it{ expect{(e / 0).to_s}.to raise_error(ZeroDivisionError) }
      it{ expect(e / 1).to eq(e) }
      it{ expect((e ^ 0).to_s).to eq('1') }
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
dydx-0.1.31 spec/lib/algebra/set/e_spec.rb
dydx-0.1.3 spec/lib/algebra/set/e_spec.rb
dydx-0.1.29 spec/lib/algebra/set/e_spec.rb
dydx-0.1.28 spec/lib/algebra/set/e_spec.rb
dydx-0.1.25 spec/lib/algebra/set/e_spec.rb
dydx-0.1.2 spec/lib/algebra/set/e_spec.rb
dydx-0.1.1 spec/lib/algebra/set/e_spec.rb
dydx-0.1.0 spec/lib/algebra/set/e_spec.rb
dydx-0.0.9 spec/lib/algebra/set/e_spec.rb
dydx-0.0.8 spec/lib/algebra/set/e_spec.rb
dydx-0.0.7 spec/lib/algebra/set/e_spec.rb
dydx-0.0.6 spec/lib/algebra/set/e_spec.rb
dydx-0.0.5 spec/lib/algebra/set/e_spec.rb
dydx-0.0.4 spec/lib/algebra/set/e_spec.rb
dydx-0.0.3 spec/lib/algebra/set/e_spec.rb
dydx-0.0.2 spec/lib/algebra/set/e_spec.rb
dydx-0.0.1 spec/lib/algebra/set/e_spec.rb