Sha256: f6738f8bd6b3f26e1f607ce945d95cf2d0868746353134678ab3609ca73335c8

Contents?: true

Size: 1.07 KB

Versions: 45

Compression:

Stored size: 1.07 KB

Contents

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

module TestEntityString
  extend Entity
  self.annotation :code
end

class TestAnnotation < Test::Unit::TestCase
  def test_marshal
    a = "STRING"
    a = TestEntityString.setup(a)

    #assert !(Annotated === Marshal.load(Marshal.dump(a)))
    assert_equal a, Marshal.load(Marshal.dump(a))
  end

  def test_marshal_array
    a = ["STRING"]
    TestEntityString.setup(a)

    #assert !(Annotated === Marshal.load(Marshal.dump(a)))
    assert Annotated === a
    assert Annotated === a.first
    assert_equal a, Marshal.load(Marshal.dump(a))
  end

  def test_hash
    e = TestEntityString.setup("TEST", :code => 10)
    assert_equal "TEST", Annotated.to_hash(e)[:literal]
    assert_equal 10, Annotated.to_hash(e)[:info][:code]
  end

  def test_traverse_cpus
    strings = (1..10).to_a.collect{|n| n.to_s }
    res = TSV.traverse strings, :cpus => 2, :into => [] do |s|
      TestEntityString.setup(s, :code => s.to_i)
    end

    assert TestEntityString === res.first
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

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