Feature #10077 » Add_test_for_Matrix#row_merge.patch
test/matrix/test_matrix.rb | ||
---|---|---|
assert_raise(ExceptionForMatrix::ErrDimensionMismatch) { Matrix[[2,0,1],[0,-2,2]].cofactor(0, 0) }
|
||
end
|
||
def test_row_merge
|
||
assert_equal(Matrix.empty(0, 4), Matrix.empty(0, 2).row_merge(Matrix.empty(0, 2)))
|
||
assert_equal(Matrix[[1, 2, 3]], Matrix[[1]].row_merge(Matrix[[2, 3]]))
|
||
assert_equal(
|
||
Matrix[[1, 2, 5, 6, 7], [3, 4, 8, 9, 10]],
|
||
Matrix[[1, 2], [3, 4]].row_merge(Matrix[[5, 6, 7], [8, 9, 10]])
|
||
)
|
||
assert_equal(
|
||
Matrix[[1, 2, 5], [3, 4, 6]],
|
||
Matrix[[1, 2], [3, 4]].row_merge(Matrix[[5], [6]])
|
||
)
|
||
assert_equal(
|
||
Matrix[[1, 2, 5, 7], [3, 4, 6, 8]],
|
||
Matrix[[1, 2], [3, 4]].row_merge(Matrix[[5], [6]], Matrix[[7], [8]])
|
||
)
|
||
assert_raise(ExceptionForMatrix::ErrDimensionMismatch) do
|
||
Matrix[[1, 2], [3, 4]].row_merge(Matrix[[5, 6], [7, 8], [9, 10]])
|
||
end
|
||
assert_raise(ExceptionForMatrix::ErrDimensionMismatch) do
|
||
Matrix[[1, 2], [3, 4]].row_merge(Matrix[[5, 6]])
|
||
end
|
||
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]]))
|