mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/matrix: Handle empty diagonal matrix case [fix GH-576]
Patch by gogotanaka git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a237db5cbc
commit
bcf8dd1096
2 changed files with 2 additions and 0 deletions
|
@ -179,6 +179,7 @@ class TestMatrix < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_diagonal
|
||||
assert_equal(Matrix.empty(0, 0), Matrix.diagonal( ))
|
||||
assert_equal(Matrix[[3,0,0],[0,2,0],[0,0,1]], Matrix.diagonal(3, 2, 1))
|
||||
assert_equal(Matrix[[4,0,0,0],[0,3,0,0],[0,0,2,0],[0,0,0,1]], Matrix.diagonal(4, 3, 2, 1))
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue