Project

General

Profile

Feature #10077 » Add_test_for_Matrix#column_merge.patch

gogotanaka (Kazuki Tanaka), 07/21/2014 02:51 AM

View differences:

test/matrix/test_matrix.rb
assert_raise(ExceptionForMatrix::ErrDimensionMismatch) { Matrix[[2,0,1],[0,-2,2]].cofactor(0, 0) }
end
def test_column_merge
assert_equal(Matrix.empty(4, 0), Matrix.empty(2, 0).column_merge(Matrix.empty(2, 0)))
assert_equal(Matrix[[1], [2], [3]], Matrix[[1]].column_merge(Matrix[[2], [3]]))
assert_equal(
Matrix[[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],
Matrix[[1, 2], [3, 4]].column_merge(Matrix[[5, 6], [7, 8], [9, 10]])
)
assert_equal(
Matrix[[1, 2], [3, 4], [5, 6]],
Matrix[[1, 2], [3, 4]].column_merge(Matrix[[5, 6]])
)
assert_equal(
Matrix[[1, 2], [3, 4], [5, 6], [7, 8]],
Matrix[[1, 2], [3, 4]].column_merge(Matrix[[5, 6]], Matrix[[7, 8]])
)
assert_raise(ExceptionForMatrix::ErrDimensionMismatch) do
Matrix[[1, 2], [3, 4]].column_merge(Matrix[[5, 6, 7], [8, 9, 10]])
end
assert_raise(ExceptionForMatrix::ErrDimensionMismatch) do
Matrix[[1, 2], [3, 4]].column_merge(Matrix[[5], [6]])
end
end
def test_regular?
assert(Matrix[[1, 0], [0, 1]].regular?)
assert(Matrix[[1, 0, 0], [0, 1, 0], [0, 0, 1]].regular?)
(2-2/6)