Sha256: 80ec33ef301ef91faad1a32a54a175f60daef29c81ce9594d80d08594df56436

Contents?: true

Size: 597 Bytes

Versions: 3

Compression:

Stored size: 597 Bytes

Contents

require 'minitest_helper'

class TestR < TestInterpreterBase
  def setup
  end

  def assert_r_compl_eq(output, input)
    assert_equal(output, Q.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

3 entries across 3 versions & 2 rubygems

Version Path
hilbert-0.0.2700001 test/langs/test_r.rb
hilbert-0.0.2700000 test/langs/test_r.rb
qlang-0.0.27182124 test/langs/test_r.rb