Skip to content

Commit 5be7fc4

Browse files
authored
Change package declaration in StochasticMatrixTest
1 parent c2c0db7 commit 5be7fc4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.thealgorithms.matrix;
2+
3+
import static org.junit.jupiter.api.Assertions.*;
4+
import org.junit.jupiter.api.Test;
5+
6+
class StochasticMatrixTest {
7+
8+
@Test
9+
void testRowStochasticMatrix() {
10+
double[][] matrix = {
11+
{0.2, 0.5, 0.3},
12+
{0.1, 0.6, 0.3}
13+
};
14+
assertTrue(StochasticMatrix.isRowStochastic(matrix));
15+
assertFalse(StochasticMatrix.isColumnStochastic(matrix));
16+
}
17+
18+
@Test
19+
void testColumnStochasticMatrix() {
20+
double[][] matrix = {
21+
{0.4, 0.2},
22+
{0.6, 0.8}
23+
};
24+
assertTrue(StochasticMatrix.isColumnStochastic(matrix));
25+
}
26+
27+
@Test
28+
void testInvalidMatrix() {
29+
double[][] matrix = {
30+
{0.5, -0.5},
31+
{0.5, 1.5}
32+
};
33+
assertFalse(StochasticMatrix.isRowStochastic(matrix));
34+
}
35+
}

0 commit comments

Comments
 (0)