Test cases for matrix.