[前][次][番号順一覧][スレッド一覧]

ruby-changes:38367

From: nobu <ko1@a...>
Date: Fri, 8 May 2015 22:57:39 +0900 (JST)
Subject: [ruby-changes:38367] nobu:r50448 (trunk): test_matrix.rb: Refactor on Matrix#determinant

nobu	2015-05-08 22:57:27 +0900 (Fri, 08 May 2015)

  New Revision: 50448

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50448

  Log:
    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]

  Modified files:
    trunk/ChangeLog
    trunk/test/matrix/test_matrix.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50447)
+++ ChangeLog	(revision 50448)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri May  8 22:57:24 2015  takiy33  <takiy33@g...>
+
+	* 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]
+
 Fri May  8 15:43:11 2015  Shugo Maeda  <shugo@r...>
 
 	* lib/net/imap.rb (body_ext_mpart): should work even if body-fld-dsp
Index: test/matrix/test_matrix.rb
===================================================================
--- test/matrix/test_matrix.rb	(revision 50447)
+++ test/matrix/test_matrix.rb	(revision 50448)
@@ -179,8 +179,11 @@ class TestMatrix < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/matrix/test_matrix.rb#L179
   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 https://github.com/ruby/ruby/blob/trunk/test/matrix/test_matrix.rb#L420
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]