Skip to content

Commit

Permalink
More tests on scrip.wait
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov committed Oct 3, 2024
1 parent ad0efec commit 67b1c5b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/trikJsRunnerTests/trikJsRunnerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ TEST_F(TrikJsRunnerTest, sanityCheckJs)

TEST_F(TrikJsRunnerTest, scriptWaitQuit)
{
QString test = "s = Date.now();"
const QString test = "s = Date.now();"
"timeout=%1;"
"script.wait(timeout);"
"e = Date.now();"
"print('Elapsed ', e-s, ' ms with expected ', timeout, ' ms');"
"assert(Math.abs(e-s-timeout) < 2);"
"assert(Math.abs(e-s-timeout) <= Math.max(2, timeout/111));"
"script.quit();";

for (auto &&t: { 3, 10, 20, 50, 100, 200, 500, 1000 }) {
for (auto &&t: { 1000, 500, 200, 100, 50, 20, 10, 5, 3, 0}) {
auto err = runDirectCommandAndWaitForQuit(test.arg(t));
mStdOut.clear();
ASSERT_EQ(err, EXIT_SCRIPT_SUCCESS);
Expand Down

0 comments on commit 67b1c5b

Please sign in to comment.