Skip to content

Commit

Permalink
[#93] fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
vbmacher committed Dec 31, 2023
1 parent de26bcf commit 3a95d3a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class AccurateFrequencyRunnerTest {

Expand All @@ -36,10 +36,10 @@ public void testRun() {

AtomicInteger runFrequency = new AtomicInteger();

calculator.start();
calculator.addListener(f -> runFrequency.set(Math.round(f)));

long startTime = System.nanoTime();
calculator.start();
runner.run(() -> frequencyKHz, () -> {
runner.addExecutedCycles(1);
calculator.passedCycles(1);
Expand All @@ -54,6 +54,6 @@ public void testRun() {
calculator.stop();
calculator.close();

assertEquals(frequencyKHz, runFrequency.get());
assertTrue(frequencyKHz == runFrequency.get() || (frequencyKHz - 1) == runFrequency.get());
}
}

0 comments on commit 3a95d3a

Please sign in to comment.