@@ -51,14 +51,16 @@ public static void afterAll() {
5151 }
5252
5353 @ BeforeEach
54- public void beforeEach () {
54+ public void beforeEach (TestInfo testInfo ) {
5555 start = Instant .now ();
56+ System .err .println ("---" );
57+ System .err .println (testInfo .getTestMethod ().get ().getName () + " " + testInfo .getDisplayName ());
5658 }
5759
5860 @ AfterEach
5961 public void afterEach (TestInfo testInfo ) {
6062 Duration duration = Duration .between (start , Instant .now ());
61- System .err .println (duration + " " + testInfo . getDisplayName () );
63+ System .err .println (duration );
6264 }
6365
6466 /**
@@ -236,6 +238,7 @@ public void testAccuracyRandom(
236238
237239 long mightContainEvenIndexed = 0 ;
238240 long mightContainOddIndexed = 0 ;
241+ long discardedOddIndexed = 0 ;
239242
240243 pseudoRandom .setSeed (deterministicSeed );
241244 for (long i = 0 ; i < iterationCount ; i ++) {
@@ -255,6 +258,8 @@ public void testAccuracyRandom(
255258 // (mitigating duplicates in input sequence)
256259 if (!bloomFilterSecondary .mightContainLong (candidate )) {
257260 mightContainOddIndexed ++;
261+ } else {
262+ discardedOddIndexed ++;
258263 }
259264 }
260265 }
@@ -266,9 +271,11 @@ public void testAccuracyRandom(
266271 "mightContainLong must return true for all inserted numbers"
267272 );
268273
269- double actualFpp = (double ) mightContainOddIndexed / numItems ;
274+ double actualFpp = (double ) mightContainOddIndexed / ( numItems - discardedOddIndexed ) ;
270275 double acceptableFpp = expectedFpp * (1 + FPP_RANDOM_ERROR_FACTOR );
271276
277+ System .err .printf ("numItems: %10d\n " , numItems );
278+ System .err .printf ("discardedOddIndexed: %10d\n " , discardedOddIndexed );
272279 System .err .printf ("expectedFpp: %f %%\n " , 100 * expectedFpp );
273280 System .err .printf ("acceptableFpp: %f %%\n " , 100 * acceptableFpp );
274281 System .err .printf ("actualFpp: %f %%\n " , 100 * actualFpp );
0 commit comments