Skip to content

Commit 9d350f0

Browse files
hamidkm9claude
andcommitted
test: cover the remaining input checks in SefrTest
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 9fda8f3 commit 9d350f0

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎src/test/java/com/thealgorithms/machinelearning/SefrTest.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ void constantFeatureGetsZeroWeight() {
7474
void rejectsInvalidInput() {
7575
Sefr sefr = new Sefr();
7676
assertThrows(IllegalStateException.class, () -> sefr.predict(new double[] {1, 2}));
77+
assertThrows(IllegalStateException.class, sefr::getWeights);
78+
assertThrows(IllegalArgumentException.class, () -> sefr.fit(null, new int[] {0, 1}));
79+
assertThrows(IllegalArgumentException.class, () -> sefr.fit(new double[][] {{1}, {2}}, null));
7780
assertThrows(IllegalArgumentException.class, () -> sefr.fit(new double[0][0], new int[0]));
81+
assertThrows(IllegalArgumentException.class, () -> sefr.fit(new double[][] {{}, {}}, new int[] {0, 1}));
82+
assertThrows(IllegalArgumentException.class, () -> sefr.fit(new double[][] {{1}, null}, new int[] {0, 1}));
7883
assertThrows(IllegalArgumentException.class, () -> sefr.fit(new double[][] {{1}, {2}}, new int[] {0}));
7984
assertThrows(IllegalArgumentException.class, () -> sefr.fit(new double[][] {{1}, {2}}, new int[] {0, 0}));
8085
assertThrows(IllegalArgumentException.class, () -> sefr.fit(new double[][] {{1, 2}, {3}}, new int[] {0, 1}));

0 commit comments

Comments
 (0)