summaryrefslogtreecommitdiff
path: root/test/matrix/test_matrix.rb
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-06 17:45:54 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-06 17:45:54 +0000
commitb8ba202301e5e4cf392a827c9bb8ebf2265de99f (patch)
tree0448fc788c02c6012adf8d0a6e0ec07962cd7f3a /test/matrix/test_matrix.rb
parent1657d516e92002a009b52d992529a04abd33a0ce (diff)
* lib/matrix.rb: Add first_minor [fix GH-568]
Patch by gogotanaka git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/matrix/test_matrix.rb')
-rw-r--r--test/matrix/test_matrix.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/matrix/test_matrix.rb b/test/matrix/test_matrix.rb
index 575b7b0cd6..2412f00822 100644
--- a/test/matrix/test_matrix.rb
+++ b/test/matrix/test_matrix.rb
@@ -250,6 +250,18 @@ class TestMatrix < Test::Unit::TestCase
assert_raise(ArgumentError) { @m1.minor(0) }
end
+ def test_first_minor
+ assert_equal(Matrix.empty(0, 0), Matrix[[1]].first_minor(0, 0))
+ assert_equal(Matrix.empty(0, 2), Matrix[[1, 4, 2]].first_minor(0, 1))
+ assert_equal(Matrix[[1, 3]], @m1.first_minor(1, 1))
+ assert_equal(Matrix[[4, 6]], @m1.first_minor(0, 1))
+ assert_equal(Matrix[[1, 2]], @m1.first_minor(1, 2))
+ assert_raise(RuntimeError) { Matrix.empty(0, 0).first_minor(0, 0) }
+ assert_raise(ArgumentError) { @m1.first_minor(4, 0) }
+ assert_raise(ArgumentError) { @m1.first_minor(0, -1) }
+ assert_raise(ArgumentError) { @m1.first_minor(-1, 4) }
+ end
+
def test_regular?
assert(Matrix[[1, 0], [0, 1]].regular?)
assert(Matrix[[1, 0, 0], [0, 1, 0], [0, 0, 1]].regular?)