Sha256: e31138529533b9e252caeee6332fc5a24c8e06a70c57ea21814c177c3825c7f8

Contents?: true

Size: 655 Bytes

Versions: 10

Compression:

Stored size: 655 Bytes

Contents

# Test lib/more/ext/enumerable/elementwise.rb'

require 'facets/elementwise.rb'
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

10 entries across 10 versions & 1 rubygems

Version Path
facets-2.6.0 test/more/test_elementwise.rb
facets-2.4.0 test/test_elementwise.rb
facets-2.4.1 test/test_elementwise.rb
facets-2.4.4 test/more/test_elementwise.rb
facets-2.4.2 test/more/test_elementwise.rb
facets-2.4.3 test/more/test_elementwise.rb
facets-2.4.5 test/more/test_elementwise.rb
facets-2.5.0 test/more/test_elementwise.rb
facets-2.5.1 test/more/test_elementwise.rb
facets-2.5.2 test/more/test_elementwise.rb