Sha256: bd3bd388ed61333a7d7ab2cbb53b69c2787fd31b3372772d7ec5e83c0ad783df

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 Bytes

Contents

require 'spec_helper'

describe Dydx::Algebra::Operator::Parts::Formula do
  it{ expect(((:a * :b) + (:a * :c)).to_s).to eq('( a * ( b + c ) )') }
  it{ expect(((:b * :a) + (:c * :a)).to_s).to eq('( ( b + c ) * a )') }
  it{ expect(((:a * :b) - (:a * :c)).to_s).to eq('( a * ( b - c ) )') }
  it{ expect(((:b * :a) - (:c * :a)).to_s).to eq('( ( b - c ) * a )') }

  it{ expect(((:x ^ 3) * (:x ^ 2)).to_s).to eq('( x ^ 5 )') }
  it{ expect(((:x ^ 3) / (:x ^ 2)).to_s).to eq('x') }
  it{ expect(((:x ^ :n) * (:y ^ :n)).to_s).to eq('( ( x * y ) ^ n )') }
  it{ expect(((:x ^ :n) / (:y ^ :n)).to_s).to eq('( ( x / y ) ^ n )') }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dydx-0.0.2 spec/lib/algebra/operator/parts/formula_spec.rb
dydx-0.0.1 spec/lib/algebra/operator/parts/formula_spec.rb