Sha256: cb09aca6066bba398269164634c07498bd6a808471182f3dccf3d2fae45defb8

Contents?: true

Size: 671 Bytes

Versions: 5

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

5 entries across 5 versions & 1 rubygems

Version Path
qlang-0.0.27182000 spec/objects/function_spec.rb
qlang-0.0.27180000 spec/objects/function_spec.rb
qlang-0.0.27100000 spec/objects/function_spec.rb
qlang-0.0.27000000 spec/objects/function_spec.rb
qlang-0.0.27 spec/objects/function_spec.rb