public class RuntimeWorkerTest {
private static final ShortDuration TIMING_INTERVAL = ShortDuration.of(100, MILLISECONDS);
@Test public void testCalculateTargetReps_tinyBenchmark() {
// this is one cycle on a 5GHz machine
ShortDuration oneCycle = ShortDuration.of(new BigDecimal("2.0e-10"), SECONDS);
long targetReps = calculateTargetReps(INITIAL_REPS,
oneCycle.times(INITIAL_REPS).to(NANOSECONDS), TIMING_INTERVAL.to(NANOSECONDS), 0.0);
long expectedReps = TIMING_INTERVAL.toPicos() / oneCycle.toPicos();
assertEquals(expectedReps, targetReps);
}