Sha256: 78436f03f18aa9b0c1b0484f034d4db93a87ca056a7729ca50124c9fc8e64869

Contents?: true

Size: 671 Bytes

Versions: 3

Compression:

Stored size: 671 Bytes

Contents

require 'spec_helper'

describe Qlang do
  describe 'Function' do
    context 'into R' do
      it do
        expect(
          Q.to_r.compile('f(x, y) = x + y')
        ).to eq(
          "f <- function(x ,y) x + y"
        )

        expect(
          Q.to_r.compile('g(x) = x ^ 2')
        ).to eq(
          "g <- function(x) x ^ 2"
        )

        expect(
          Q.to_r.compile('g(x) = x ^ (2 + 2)')
        ).to eq(
          "g <- function(x) x ^ (2 + 2)"
        )

        expect(
          Q.to_r.compile('h(a, b, c) = a ^ 2 + b ^ 2 + c ^ 2')
        ).to eq(
          "h <- function(a ,b ,c) a ^ 2 + b ^ 2 + c ^ 2"
        )
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
qlang-0.0.14142135 spec/objects/function_spec.rb
qlang-0.0.1414213 spec/objects/function_spec.rb
qlang-0.0.141421 spec/objects/function_spec.rb