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.54 test/rbbt/util/test_R.rb
rbbt-util-5.21.53 test/rbbt/util/test_R.rb
rbbt-util-5.21.51 test/rbbt/util/test_R.rb
rbbt-util-5.21.50 test/rbbt/util/test_R.rb
rbbt-util-5.21.49 test/rbbt/util/test_R.rb
rbbt-util-5.21.47 test/rbbt/util/test_R.rb
rbbt-util-5.21.46 test/rbbt/util/test_R.rb
rbbt-util-5.21.45 test/rbbt/util/test_R.rb
rbbt-util-5.21.44 test/rbbt/util/test_R.rb
rbbt-util-5.21.43 test/rbbt/util/test_R.rb
rbbt-util-5.21.42 test/rbbt/util/test_R.rb
rbbt-util-5.21.39 test/rbbt/util/test_R.rb
rbbt-util-5.21.38 test/rbbt/util/test_R.rb
rbbt-util-5.21.37 test/rbbt/util/test_R.rb
rbbt-util-5.21.36 test/rbbt/util/test_R.rb
rbbt-util-5.21.35 test/rbbt/util/test_R.rb
rbbt-util-5.21.34 test/rbbt/util/test_R.rb
rbbt-util-5.21.33 test/rbbt/util/test_R.rb
rbbt-util-5.21.32 test/rbbt/util/test_R.rb
rbbt-util-5.21.31 test/rbbt/util/test_R.rb