Sha256: f37f853a572813fe422c2ce16db0f9b7fd8ad18281972d53fbd8164beb7d73b6

Contents?: true

Size: 852 Bytes

Versions: 7

Compression:

Stored size: 852 Bytes

Contents

require 'minitest_helper'

class TestDifferential < TestInterpreterBase

  # TODO: opposite
  def assert_iq_equal(output, input)
    assert_equal(output, Hilbert::Iq.execute(input))
  end

  def setup
  end

  def test_general
    assert_iq_equal(
      'e ^ x',
      'd/dx(e ** x)'
    )

    assert_iq_equal(
      '2x',
      'd/dx(x ** 2)'
    )

    assert_iq_equal(
      '2',
      'd/dx(x * 2)'
    )

    assert_iq_equal(
      'cos( x )',
      'd/dx( sin(x) )'
    )

    assert_iq_equal(
      '1 / x',
      'd/dx(log(x))'
    )

    assert_iq_equal(
      '- sin( x )',
      'd/dx cos(x)'
    )

    assert_iq_equal(
      '2x',
      'd/dx xx'
    )

    assert_iq_equal(
      '1 / x',
      'd/dx log(x)'
    )

    assert_iq_equal(
      '( cos( x ) / x ) + ( log( x )( - sin( x ) ) )',
      'd/dx log(x) * cos(x)'
    )
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hilbert-0.0.2700420 test/interpreter/test_differential.rb
hilbert-0.0.2700410 test/interpreter/test_differential.rb
hilbert-0.0.2700400 test/interpreter/test_differential.rb
hilbert-0.0.2700320 test/interpreter/test_differential.rb
hilbert-0.0.2700300 test/interpreter/test_differential.rb
hilbert-0.0.2700210 test/interpreter/test_differential.rb
hilbert-0.0.2700110 test/interpreter/test_differential.rb