mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
a5b6bde856
commit
1657d516e9
1 changed files with 3 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue