Skip to content

Commit 73f1e98

Browse files
committed
Add more test details to error message
1 parent c00c7a9 commit 73f1e98

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/ArraySamplerTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,8 @@ void testShuffleIsRandom(int length) {
322322
}
323323
}
324324
final double p = new ChiSquareTest().chiSquareTest(counts);
325-
Assertions.assertFalse(p < 1e-3, () -> "p-value too small: " + p);
325+
Assertions.assertFalse(p < 1e-3,
326+
() -> String.format("p-value too small: %s. length=%d", p, length));
326327
}
327328

328329
@ParameterizedTest
@@ -345,7 +346,8 @@ void testShuffleSubRangeIsRandom(int from, int to, int length) {
345346
}
346347
}
347348
final double p = new ChiSquareTest().chiSquareTest(counts);
348-
Assertions.assertFalse(p < 1e-3, () -> "p-value too small: " + p);
349+
Assertions.assertFalse(p < 1e-3,
350+
() -> String.format("p-value too small: %s. [%d, %d) length=%d", p, from, to, length));
349351
}
350352

351353

@@ -365,7 +367,8 @@ void testShuffleIsRandomLarge(int length) {
365367
}
366368
}
367369
final double p = new ChiSquareTest().chiSquareTest(counts);
368-
Assertions.assertFalse(p < 1e-3, () -> "p-value too small: " + p);
370+
Assertions.assertFalse(p < 1e-3,
371+
() -> String.format("p-value too small: %s. length=%d", p, length));
369372
}
370373

371374
@ParameterizedTest
@@ -386,7 +389,8 @@ void testShuffleSubRangeIsRandomLarge(int from, int to, int length) {
386389
}
387390
}
388391
final double p = new ChiSquareTest().chiSquareTest(counts);
389-
Assertions.assertFalse(p < 1e-3, () -> "p-value too small: " + p);
392+
Assertions.assertFalse(p < 1e-3,
393+
() -> String.format("p-value too small: %s. [%d, %d) length=%d", p, from, to, length));
390394
}
391395

392396
// Test other implementations. Include zero length arrays.

0 commit comments

Comments
 (0)