From 492fbf53f2c4c4146bd1be1b511ecb9d54b8e653 Mon Sep 17 00:00:00 2001 From: Simon Wegendt Date: Mon, 25 Nov 2019 16:25:18 +0100 Subject: [PATCH] fix test? --- .../eclipse/mita/program/runtime/tests/EpochTimeTest.xtend | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.mita.program.tests/src/org/eclipse/mita/program/runtime/tests/EpochTimeTest.xtend b/bundles/org.eclipse.mita.program.tests/src/org/eclipse/mita/program/runtime/tests/EpochTimeTest.xtend index c3f98d03..121e5850 100644 --- a/bundles/org.eclipse.mita.program.tests/src/org/eclipse/mita/program/runtime/tests/EpochTimeTest.xtend +++ b/bundles/org.eclipse.mita.program.tests/src/org/eclipse/mita/program/runtime/tests/EpochTimeTest.xtend @@ -43,9 +43,10 @@ class EpochTimeTest extends AbstractRuntimeTest { val executable = projectPath.resolve(Paths.get("src-gen", "build", "app")); val lines = runAtMost(executable, 60); val lastLine = lines.iterator.last; - val timeFromApp = Integer.parseInt(lastLine); - val timeFromJava = Instant.now().toEpochMilli(); + val timeFromApp = Integer.parseInt(lastLine).intValue; + val timeFromJava = Instant.now().toEpochMilli() as int; println('''java: «timeFromJava», testling: «timeFromApp»''') - Assert.assertTrue(Math.abs(timeFromJava as int - timeFromApp) < 10); + // time difference should be less than 2s + Assert.assertTrue(Math.abs(timeFromJava - timeFromApp) < 2000); } } \ No newline at end of file