1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/matrix.rb: Fix Matrix.rows copy bug.

Patch by Arron Mabrey. [Fix GH-707]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2014-10-03 03:38:06 +00:00
parent 1b5acebef2
commit f59098d118
3 changed files with 20 additions and 1 deletions

View file

@ -177,6 +177,20 @@ class TestMatrix < Test::Unit::TestCase
assert_equal(@m1, Matrix.rows([[1, 2, 3], [4, 5, 6]]))
end
def test_rows_copy
rows1 = [[1], [1]]
rows2 = [[1], [1]]
m1 = Matrix.rows(rows1, copy = false)
m2 = Matrix.rows(rows2, copy = true)
rows1.uniq!
rows2.uniq!
assert_equal([[1]], m1.to_a)
assert_equal([[1], [1]], m2.to_a)
end
def test_columns
assert_equal(@m1, Matrix.columns([[1, 4], [2, 5], [3, 6]]))
end