Sha256: ec0c32a5a104905cb68cd9e0adadb8cd1c50f4e1be97d494d655c443fd8905b4

Contents?: true

Size: 584 Bytes

Versions: 1

Compression:

Stored size: 584 Bytes

Contents

require 'minitest_helper'

class TestHilbert < MiniTest::Unit::TestCase
  def setup
  end

  def assert_to_ruby(input, output)
    assert_equal(Q.to_ruby.compile(input), output)
  end

  def test_basis
    refute_nil ::Hilbert::VERSION
    assert_equal(Hilbert, Q)
  end

  def test_demo_code
    assert_to_ruby('d/dx(sin(x))', 'd/dx(sin(x))')
    assert_to_ruby('d/dx(log(x))', 'd/dx(log(x))')
    assert_to_ruby('f(x, y) = x + y', 'f(x, y) <= x + y')
    assert_equal(Matrix[[1, 2, 3], [4, 5, 6]].to_q, '(1 2 3; 4 5 6)')
    assert_equal(Vector[1, 2, 3].to_q, '(1 2 3)')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hilbert-0.0.2700001 test/test_qlang.rb