Sha256: ca8d5b6d75033b8dde90ed51f82921c56d9f1f512e79551dc62f61354cbceb58

Contents?: true

Size: 598 Bytes

Versions: 6

Compression:

Stored size: 598 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

6 entries across 6 versions & 1 rubygems

Version Path
qlang-0.0.27182123 test/langs/test_r.rb
qlang-0.0.27182122 test/langs/test_r.rb
qlang-0.0.27182121 test/langs/test_r.rb
qlang-0.0.27182120 test/langs/test_r.rb
qlang-0.0.27182110 test/langs/test_r.rb
qlang-0.0.27182100 test/langs/test_r.rb