Sha256: 04f68bce8050d34165360a08a6c32148dc69f55a1a5c17b022f27be928786224

Contents?: true

Size: 686 Bytes

Versions: 334

Compression:

Stored size: 686 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
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
end

Version data entries

334 entries across 334 versions & 1 rubygems

Version Path
rbbt-util-5.21.121 test/rbbt/util/test_R.rb
rbbt-util-5.21.120 test/rbbt/util/test_R.rb
rbbt-util-5.21.119 test/rbbt/util/test_R.rb
rbbt-util-5.21.118 test/rbbt/util/test_R.rb
rbbt-util-5.21.116 test/rbbt/util/test_R.rb
rbbt-util-5.21.115 test/rbbt/util/test_R.rb
rbbt-util-5.21.114 test/rbbt/util/test_R.rb
rbbt-util-5.21.113 test/rbbt/util/test_R.rb
rbbt-util-5.21.112 test/rbbt/util/test_R.rb
rbbt-util-5.21.111 test/rbbt/util/test_R.rb
rbbt-util-5.21.110 test/rbbt/util/test_R.rb
rbbt-util-5.21.109 test/rbbt/util/test_R.rb
rbbt-util-5.21.107 test/rbbt/util/test_R.rb
rbbt-util-5.21.106 test/rbbt/util/test_R.rb
rbbt-util-5.21.104 test/rbbt/util/test_R.rb
rbbt-util-5.21.103 test/rbbt/util/test_R.rb
rbbt-util-5.21.102 test/rbbt/util/test_R.rb
rbbt-util-5.21.101 test/rbbt/util/test_R.rb
rbbt-util-5.21.100 test/rbbt/util/test_R.rb
rbbt-util-5.21.99 test/rbbt/util/test_R.rb