Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: improve assertions in pummel/test-timers
* Timers should not fire early. Check for that.
* Allow the wiggle-room to increase on subsequent iterations of
  intervals.

PR-URL: #35216
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Andrey Pechkurov <[email protected]>
Reviewed-By: Anto Aravinth <[email protected]>
  • Loading branch information
Trott committed Sep 20, 2020
commit 87c433e120604b2c44b87d5f6bcd8f8e00da6af6
4 changes: 2 additions & 2 deletions test/pummel/test-timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const WINDOW = 200; // Why does this need to be so big?
assert.ok(diff > 0);
console.error(`diff: ${diff}`);

assert.strictEqual(1000 - WINDOW < diff && diff < 1000 + WINDOW, true);
assert.ok(1000 <= diff && diff < 1000 + WINDOW);
}), 1000);
}

Expand All @@ -61,7 +61,7 @@ const WINDOW = 200; // Why does this need to be so big?

const t = interval_count * 1000;

assert.ok(t - WINDOW < diff && diff < t + WINDOW, `t: ${t}`);
assert.ok(t <= diff && diff < t + (WINDOW * interval_count));

assert.ok(interval_count <= 3, `interval_count: ${interval_count}`);
if (interval_count === 3)
Expand Down