summaryrefslogtreecommitdiff
path: root/test/parallel/test-zlib-random-byte-pipes.js
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-12-10 15:48:50 +0100
committerAnna Henningsen <anna@addaleax.net>2019-01-05 21:36:47 +0100
commitb7da5b79c300b2d5abf6658ba3fa8edf916f05cc (patch)
treeff29b5e91c7843edf163a15b47b8d99723902831 /test/parallel/test-zlib-random-byte-pipes.js
parent73753d48639200f79957b822599e9848b0ac942f (diff)
downloadandroid-node-v8-b7da5b79c300b2d5abf6658ba3fa8edf916f05cc.tar.gz
android-node-v8-b7da5b79c300b2d5abf6658ba3fa8edf916f05cc.tar.bz2
android-node-v8-b7da5b79c300b2d5abf6658ba3fa8edf916f05cc.zip
benchmark,test: add brotli
Co-authored-by: Hackzzila <admin@hackzzila.com> PR-URL: https://github.com/nodejs/node/pull/24938 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'test/parallel/test-zlib-random-byte-pipes.js')
-rw-r--r--test/parallel/test-zlib-random-byte-pipes.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/test/parallel/test-zlib-random-byte-pipes.js b/test/parallel/test-zlib-random-byte-pipes.js
index 9c679ab0a0..c7026163e7 100644
--- a/test/parallel/test-zlib-random-byte-pipes.js
+++ b/test/parallel/test-zlib-random-byte-pipes.js
@@ -141,14 +141,18 @@ class HashStream extends Stream {
}
}
-
-const inp = new RandomReadStream({ total: 1024, block: 256, jitter: 16 });
-const out = new HashStream();
-const gzip = zlib.createGzip();
-const gunz = zlib.createGunzip();
-
-inp.pipe(gzip).pipe(gunz).pipe(out);
-
-out.on('data', common.mustCall((c) => {
- assert.strictEqual(c, inp._hash, `Hash '${c}' equals '${inp._hash}'.`);
-}));
+for (const [ createCompress, createDecompress ] of [
+ [ zlib.createGzip, zlib.createGunzip ],
+ [ zlib.createBrotliCompress, zlib.createBrotliDecompress ],
+]) {
+ const inp = new RandomReadStream({ total: 1024, block: 256, jitter: 16 });
+ const out = new HashStream();
+ const gzip = createCompress();
+ const gunz = createDecompress();
+
+ inp.pipe(gzip).pipe(gunz).pipe(out);
+
+ out.on('data', common.mustCall((c) => {
+ assert.strictEqual(c, inp._hash, `Hash '${c}' equals '${inp._hash}'.`);
+ }));
+}