From 1657d516e92002a009b52d992529a04abd33a0ce Mon Sep 17 00:00:00 2001 From: marcandre Date: Sun, 6 Apr 2014 17:45:28 +0000 Subject: * test/matrix/test_matrix: Add tests for trivial cases [fix GH-576] Patch by gogotanaka git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/matrix/test_matrix.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/matrix/test_matrix.rb') diff --git a/test/matrix/test_matrix.rb b/test/matrix/test_matrix.rb index 50ab00cca7..575b7b0cd6 100644 --- a/test/matrix/test_matrix.rb +++ b/test/matrix/test_matrix.rb @@ -155,7 +155,9 @@ class TestMatrix < Test::Unit::TestCase end def test_inverse + assert_equal(Matrix.empty(0, 0), Matrix.empty.inverse) assert_equal(Matrix[[-1, 1], [0, -1]], Matrix[[-1, -1], [0, -1]].inverse) + assert_raise(ExceptionForMatrix::ErrDimensionMismatch) { @m1.inverse } end def test_determinant @@ -185,6 +187,7 @@ class TestMatrix < Test::Unit::TestCase end def test_scalar + assert_equal(Matrix.empty(0, 0), Matrix.scalar(0, 1)) assert_equal(Matrix[[2,0,0],[0,2,0],[0,0,2]], Matrix.scalar(3, 2)) assert_equal(Matrix[[2,0,0,0],[0,2,0,0],[0,0,2,0],[0,0,0,2]], Matrix.scalar(4, 2)) end -- cgit v1.2.3