Sha256: ae1fcafd531a6d4816416fc2eeaeea83670364e05112a05492c6cdf3b0ced0e1

Contents?: true

Size: 603 Bytes

Versions: 8

Compression:

Stored size: 603 Bytes

Contents

require 'minitest_helper'

class TestR < TestInterpreterBase
  def setup
  end

  def assert_r_compl_eq(output, input)
    assert_equal(output, Hilbert.to_r.compile(input))
  end

  def test_function
    assert_r_compl_eq(
      "f <- function(x, y) x + y",
      'f(x, y) = x + y'
    )

    assert_r_compl_eq(
      "g <- function(x) x ^ 2",
      'g(x) = x ^ 2'
    )

    assert_r_compl_eq(
      "g <- function(x) x ^ (2 + 2)",
      'g(x) = x ^ (2 + 2)'
    )

    assert_r_compl_eq(
      "h <- function(a, b, c) a ^ 2 + b ^ 2 + c ^ 2",
      'h(a, b, c) = a ^ 2 + b ^ 2 + c ^ 2'
    )
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hilbert-0.0.2700420 test/langs/test_r.rb
hilbert-0.0.2700410 test/langs/test_r.rb
hilbert-0.0.2700400 test/langs/test_r.rb
hilbert-0.0.2700320 test/langs/test_r.rb
hilbert-0.0.2700300 test/langs/test_r.rb
hilbert-0.0.2700210 test/langs/test_r.rb
hilbert-0.0.2700110 test/langs/test_r.rb
hilbert-0.0.2700100 test/langs/test_r.rb