mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fix time-based test for worse timer resolution
This commit is contained in:
parent
fb81153ad2
commit
bc9ad315ff
|
@ -51,9 +51,10 @@ public class ThreadTest {
|
|||
Thread.sleep(5000);
|
||||
fail("Exception expected");
|
||||
} catch (InterruptedException e) {
|
||||
long end = System.currentTimeMillis();
|
||||
assertEquals(Thread.currentThread(), mainThread);
|
||||
assertFalse(mainThread.isInterrupted());
|
||||
assertTrue(System.currentTimeMillis() - start < 500);
|
||||
assertTrue("Wait time " + (end - start), end - start < 5000);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ public class ArrayBlockingQueueTest {
|
|||
long start = System.currentTimeMillis();
|
||||
queue.put(3);
|
||||
long end = System.currentTimeMillis();
|
||||
assertTrue("Wait time " + (end - start), start + 50 < end && start + 500 > end);
|
||||
assertTrue("Wait time " + (end - start), start + 50 < end && start + 5000 > end);
|
||||
|
||||
assertEquals(3, queue.remove().intValue());
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class ArrayBlockingQueueTest {
|
|||
long end = System.currentTimeMillis();
|
||||
int b = queue.take();
|
||||
|
||||
assertTrue("Wait time " + (end - start), start + 100 < end && start + 900 > end);
|
||||
assertTrue("Wait time " + (end - start), start + 100 < end && start + 5000 > end);
|
||||
assertEquals(1, a);
|
||||
assertEquals(2, b);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user