Sha256: 8f3afafb71a2d45654f70b8ee7de0f1b207ae7844aa1e833f936d9d2729d260d

Contents?: true

Size: 756 Bytes

Versions: 1

Compression:

Stored size: 756 Bytes

Contents

require 'spec_helper'

describe Dydx do
  it 'has a version number' do
    expect(Dydx::VERSION).not_to be nil
  end

  context 'ex1' do
    $a = (:x ^ :n)
    let(:d1){ da/dx }
    let(:d2){ d/dx($a) }
    it{ expect(d1.to_s).to eq('( n * ( x ^ ( n - 1 ) ) )') }
    it{ expect(d2.to_s).to eq('( n * ( x ^ ( n - 1 ) ) )') }
  end

  context 'ex2' do
    $b = (:x ^ (:x * 2))
    let(:d1){ db/dx }
    let(:d2){ d/dx($b) }
    it{ expect(d1.to_s).to eq('( ( x * 2 ) * ( x ^ ( ( x * 2 ) - 1 ) ) )') }
    it{ expect(d2.to_s).to eq('( ( x * 2 ) * ( x ^ ( ( x * 2 ) - 1 ) ) )') }
  end

  context 'ex3' do
    $c = (:t ^ 2) / 2
    let(:d1){ dc/dt }
    let(:d2){ d/dt($c) }
    it{ expect(d1.to_s).to eq('t') }
    it{ expect(d2.to_s).to eq('t') }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dydx-0.0.4 spec/dydx_spec.rb