Skip to content

Commit a9438d2

Browse files
committed
method for test matrix dimension error
1 parent f661455 commit a9438d2

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/test/java/com/thealgorithms/matrix/MatrixMultiplicationTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ void testMultiplyNull(){
4646
}
4747

4848

49+
@Test
50+
void testIncompatibleDimensions() {
51+
double[][] A = {
52+
{1.0, 2.0}
53+
};
54+
double[][] B = {
55+
{1.0, 2.0}
56+
};
57+
assertThrows(IllegalArgumentException.class, () -> MatrixMultiplication.multiply(A, B));
58+
}
59+
60+
4961
private void assertMatrixEquals(double[][] expected, double[][] actual) {
5062
assertEquals(expected.length, actual.length, "Row count mismatch");
5163
for (int i = 0; i < expected.length; i++) {

0 commit comments

Comments
 (0)