Add unit tests for Matrix.