diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-08 13:57:27 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-08 13:57:27 +0000 |
commit | fb684ba4c26778120233f630d8ca39ada3e9b17f (patch) | |
tree | eddc9aec42b46229573f1e8925ae32927e91c37c /test/matrix/test_matrix.rb | |
parent | 596663589b4478371863a71b4436548c670f0fe6 (diff) | |
download | ruby-fb684ba4c26778120233f630d8ca39ada3e9b17f.tar.gz |
test_matrix.rb: Refactor on Matrix#determinant
* test/matrix/test_matrix.rb (test_determinant): refactor test on
Matrix#determinant, by merging with test_det for an alias method
det. [Fix GH-897]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/matrix/test_matrix.rb')
-rw-r--r-- | test/matrix/test_matrix.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/matrix/test_matrix.rb b/test/matrix/test_matrix.rb index 7f058abe37..e2530f7366 100644 --- a/test/matrix/test_matrix.rb +++ b/test/matrix/test_matrix.rb @@ -179,8 +179,11 @@ class TestMatrix < Test::Unit::TestCase end def test_determinant + assert_equal(0, Matrix[[0,0],[0,0]].determinant) assert_equal(45, Matrix[[7,6], [3,9]].determinant) assert_equal(-18, Matrix[[2,0,1],[0,-2,2],[1,2,3]].determinant) + assert_equal(-7, Matrix[[0,0,1],[0,7,6],[1,3,9]].determinant) + assert_equal(42, Matrix[[7,0,1,0,12],[8,1,1,9,1],[4,0,0,-7,17],[-1,0,0,-4,8],[10,1,1,8,6]].determinant) end def test_new_matrix @@ -417,10 +420,7 @@ class TestMatrix < Test::Unit::TestCase end def test_det - assert_equal(45, Matrix[[7,6],[3,9]].det) - assert_equal(0, Matrix[[0,0],[0,0]].det) - assert_equal(-7, Matrix[[0,0,1],[0,7,6],[1,3,9]].det) - assert_equal(42, Matrix[[7,0,1,0,12],[8,1,1,9,1],[4,0,0,-7,17],[-1,0,0,-4,8],[10,1,1,8,6]].det) + assert_equal(Matrix.instance_method(:determinant), Matrix.instance_method(:det)) end def test_rank2 |