src: disable fast math on arm
[platform/upstream/nodejs.git] / test / parallel / test-timers-immediate-queue.js
1 var common = require('../common');
2 var assert = require('assert');
3
4 // setImmediate should run clear its queued cbs once per event loop turn
5 // but immediates queued while processing the current queue should happen
6 // on the next turn of the event loop.
7
8 // in v0.10 hit should be 1, because we only process one cb per turn
9 // in v0.11 and beyond it should be the exact same size of QUEUE
10 // if we're letting things recursively add to the immediate QUEUE hit will be
11 // > QUEUE
12
13 var ticked = false;
14
15 var hit = 0;
16 var QUEUE = 1000;
17
18 function run() {
19   if (hit === 0)
20     process.nextTick(function() { ticked = true; });
21
22   if (ticked) return;
23
24   hit += 1;
25   setImmediate(run);
26 }
27
28 for (var i = 0; i < QUEUE; i++)
29   setImmediate(run);
30
31 process.on('exit', function() {
32   console.log('hit', hit);
33   assert.strictEqual(hit, QUEUE, 'We ticked between the immediate queue');
34 });