Sha256: 7b55545b629fb1797e016f0fdb4cdef288d37a6501d67a62b949b0c27ab37d6f

Contents?: true

Size: 887 Bytes

Versions: 140

Compression:

Stored size: 887 Bytes

Contents

require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
require 'rbbt/util/R'

class TestR < Test::Unit::TestCase
  def test_sum
    assert_equal "6", R.run('cat(3+3)').read.split(/\n/).last
  end

  def test_tsv_R
    tsv = TSV.setup({:a => 1, :b => 2})
    tsv2 = tsv.R <<-EOF
str(data)
data = data + 1
    EOF
    assert_equal "2", tsv2["a"].first
  end

  def test_format_tsv
    tsv = TSV.setup({"a" => [1], "b" => [2]}, :type => :list, :key_field => "Letter", :fields => ["Number"])
    assert tsv.transpose("Field").include? "Number"
  end

  def test_error
    assert_raise ProcessFailed do
      R.run <<-EOF
        fadsfasdf
      EOF
    end
  end

  def test_hash2Rargs
    hash = {:verbose => false, :iter => 1000, :method => 'kmeans'}
    str = R.hash2Rargs(hash)
    assert_equal "verbose=FALSE, iter=1000, method='kmeans'", str
  end
end

Version data entries

140 entries across 140 versions & 1 rubygems

Version Path
rbbt-util-5.43.0 test/rbbt/util/test_R.rb
rbbt-util-5.42.0 test/rbbt/util/test_R.rb
rbbt-util-5.41.1 test/rbbt/util/test_R.rb
rbbt-util-5.41.0 test/rbbt/util/test_R.rb
rbbt-util-5.40.5 test/rbbt/util/test_R.rb
rbbt-util-5.40.4 test/rbbt/util/test_R.rb
rbbt-util-5.40.3 test/rbbt/util/test_R.rb
rbbt-util-5.40.0 test/rbbt/util/test_R.rb
rbbt-util-5.39.0 test/rbbt/util/test_R.rb
rbbt-util-5.38.1 test/rbbt/util/test_R.rb
rbbt-util-5.38.0 test/rbbt/util/test_R.rb
rbbt-util-5.37.16 test/rbbt/util/test_R.rb
rbbt-util-5.37.15 test/rbbt/util/test_R.rb
rbbt-util-5.37.14 test/rbbt/util/test_R.rb
rbbt-util-5.37.13 test/rbbt/util/test_R.rb
rbbt-util-5.37.12 test/rbbt/util/test_R.rb
rbbt-util-5.37.11 test/rbbt/util/test_R.rb
rbbt-util-5.37.10 test/rbbt/util/test_R.rb
rbbt-util-5.37.9 test/rbbt/util/test_R.rb
rbbt-util-5.37.8 test/rbbt/util/test_R.rb