Files
react-native-devtools-frontend/node_modules/fast-fifo/test.js
T
Randolf Jung bcb3bc8d41 Update puppeteer and @puppeteer/replay
- puppeteer replaced with puppeteer-core (20.7.3). DevTools does not actually need puppeteer as it downloads the browsers on its own. PUPPETEER_SKIP_CHROMIUM_DOWNLOAD is not needed too.
- @puppeteer/replay upgraded to 2.11.2

DISABLE_THIRD_PARTY_CHECK=requires code updates for puppeteer-core
Bug: none
Change-Id: I173c228d766681a1a8a9ada3fcf17525cd191726
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4640022
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Randolf Jung <jrandolf@chromium.org>
2023-06-26 18:05:57 +00:00

63 lines
888 B
JavaScript

const tape = require('tape')
const FIFO = require('./')
tape('basic', function (t) {
const q = new FIFO()
const values = [
1,
4,
4,
0,
null,
{},
Math.random(),
'',
'hello',
9,
1,
4,
5,
6,
7,
null,
null,
0,
0,
15,
52.2,
null
]
t.same(q.shift(), undefined)
t.ok(q.isEmpty())
t.equal(q.length, 0)
for (const value of values) q.push(value)
while (!q.isEmpty()) {
t.same(q.shift(), values.shift())
t.equal(q.length, values.length)
}
t.same(q.shift(), undefined)
t.ok(q.isEmpty())
t.end()
})
tape('long length', function (t) {
const q = new FIFO()
const len = 0x8f7
for (let i = 0; i < len; i++) q.push(i)
t.same(q.length, len)
let shifts = 0
while (!q.isEmpty()) {
q.shift()
shifts++
}
t.same(shifts, len)
t.same(q.length, 0)
t.end()
})