aboutsummaryrefslogtreecommitdiffstats
path: root/test/matrix
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-06 17:45:07 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-06 17:45:07 +0000
commitbcf8dd1096bc3660b2f56b0c70d00c33c79c995d (patch)
treeea2e910f0f35d0d79313cf4ad0ef25a260ff55c5 /test/matrix
parenta237db5cbc3e3093330c20b26a97320262ee7b16 (diff)
downloadruby-bcf8dd1096bc3660b2f56b0c70d00c33c79c995d.tar.gz
* 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
Diffstat (limited to 'test/matrix')
-rw-r--r--test/matrix/test_matrix.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/matrix/test_matrix.rb b/test/matrix/test_matrix.rb
index 26248e5746..50ab00cca7 100644
--- a/test/matrix/test_matrix.rb
+++ b/test/matrix/test_matrix.rb
@@ -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