Sha256: 7d2ed9e8ac37ffbd8b8d8b001e83d6daf2ec6dbde46537344f3510f8e29f0f50

Contents?: true

Size: 617 Bytes

Versions: 6

Compression:

Stored size: 617 Bytes

Contents

require 'facets/enumerable/ewise'
require 'test/unit'

class TestElementWise < Test::Unit::TestCase

  #def test_elementwise
  #  a = [1,2,3]
  #  b = [4,5]
  #  assert_equal( [4,5,6], a.elementwise + 3 )
  #  assert_equal( [5,7], a.elementwise + b )
  #  assert_equal( [[5,7],[3,4,5]], a.elementwise.+(b,2) )
  #  assert_equal( [[5,7],[4,5,6]], a.elementwise.+(b,3) )
  #end

  def test_ewise
    a = [1,2,3]
    assert_equal( [4,5,6], a.ewise + 3 )
    assert_equal( [5,7], a.ewise + [4,5] )
    assert_equal( [[5,7],[3,4,5]], a.ewise.+([4,5],2) )
    assert_equal( [[5,7],[4,5,6]], a.ewise.+([4,5],3) )
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
facets-2.8.4 test/core/enumerable/test_ewise.rb
facets-2.8.3 test/core/enumerable/test_ewise.rb
facets-2.8.2 test/core/enumerable/test_ewise.rb
facets-2.8.1 test/core/enumerable/test_ewise.rb
facets-2.8.0 test/core/enumerable/test_ewise.rb
facets-2.7.0 test/core/enumerable/test_ewise.rb