Sha256: bdb4294bf0a3d9380dae919c4fbebaa746b440183417bda31933c0554ed321ce

Contents?: true

Size: 794 Bytes

Versions: 5

Compression:

Stored size: 794 Bytes

Contents

require 'spec_helper'

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

  it 'has alias as Q' do
    expect(Qlang).to eq Q
  end

  describe Dydx do
    it 'check some example' do
      expect(d/dx(sin(x))).to eq cos(x)

      expect(
        Q.to_ruby.compile('d/dx(sin(x))')
      ).to eq(
        "d/dx(sin (x))"
      )

      expect(
        Q.to_ruby.compile('d/dx(log(x))')
      ).to eq(
        "d/dx(log (x))"
      )

      expect(
        Q.to_ruby.compile('f(x, y) = x + y')
      ).to eq(
        "f(x, y) <= x + y"
      )

      expect(
        Matrix[[1, 2, 3], [4, 5, 6]].to_q
      ).to eq(
        "(1 2 3; 4 5 6)"
      )

      expect(
        Vector[1, 2, 3].to_q
      ).to eq(
        "(1 2 3)"
      )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
qlang-0.0.27182000 spec/q_lang_spec.rb
qlang-0.0.27180000 spec/q_lang_spec.rb
qlang-0.0.27100000 spec/q_lang_spec.rb
qlang-0.0.27000000 spec/q_lang_spec.rb
qlang-0.0.27 spec/q_lang_spec.rb