aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/tar/node_modules/block-stream/test/nopad-thorough.js
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2017-05-09 14:46:02 -0700
committerAnna Henningsen <anna@addaleax.net>2017-05-23 19:39:43 +0200
commitc0d858f8bb8ba5212548da2fba6a7bc02db0462b (patch)
tree99f043ec5aec3f5150a2aed0f62597234b158140 /deps/npm/node_modules/tar/node_modules/block-stream/test/nopad-thorough.js
parent994617370e8e66f3ea9488fec32fd912e7902396 (diff)
downloadandroid-node-v8-c0d858f8bb8ba5212548da2fba6a7bc02db0462b.tar.gz
android-node-v8-c0d858f8bb8ba5212548da2fba6a7bc02db0462b.tar.bz2
android-node-v8-c0d858f8bb8ba5212548da2fba6a7bc02db0462b.zip
deps: upgrade npm beta to 5.0.0-beta.56
PR-URL: https://github.com/nodejs/node/pull/12936 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'deps/npm/node_modules/tar/node_modules/block-stream/test/nopad-thorough.js')
-rw-r--r--deps/npm/node_modules/tar/node_modules/block-stream/test/nopad-thorough.js68
1 files changed, 0 insertions, 68 deletions
diff --git a/deps/npm/node_modules/tar/node_modules/block-stream/test/nopad-thorough.js b/deps/npm/node_modules/tar/node_modules/block-stream/test/nopad-thorough.js
deleted file mode 100644
index 7a8de88b5b..0000000000
--- a/deps/npm/node_modules/tar/node_modules/block-stream/test/nopad-thorough.js
+++ /dev/null
@@ -1,68 +0,0 @@
-var BlockStream = require("../block-stream.js")
-
-var blockSizes = [16]//, 25]//, 1024]
- , writeSizes = [4, 15, 16, 17, 64 ]//, 64, 100]
- , writeCounts = [1, 10]//, 100]
- , tap = require("tap")
-
-writeCounts.forEach(function (writeCount) {
-blockSizes.forEach(function (blockSize) {
-writeSizes.forEach(function (writeSize) {
- tap.test("writeSize=" + writeSize +
- " blockSize="+blockSize +
- " writeCount="+writeCount, function (t) {
- var f = new BlockStream(blockSize, {nopad: true })
-
- var actualChunks = 0
- var actualBytes = 0
- var timeouts = 0
-
- f.on("data", function (c) {
- timeouts ++
-
- actualChunks ++
- actualBytes += c.length
-
- // make sure that no data gets corrupted, and basic sanity
- var before = c.toString()
- // simulate a slow write operation
- setTimeout(function () {
- timeouts --
-
- var after = c.toString()
- t.equal(after, before, "should not change data")
-
- // now corrupt it, to find leaks.
- for (var i = 0; i < c.length; i ++) {
- c[i] = "x".charCodeAt(0)
- }
- }, 100)
- })
-
- f.on("end", function () {
- // round up to the nearest block size
- var expectChunks = Math.ceil(writeSize * writeCount * 2 / blockSize)
- var expectBytes = writeSize * writeCount * 2
- t.equal(actualBytes, expectBytes,
- "bytes=" + expectBytes + " writeSize=" + writeSize)
- t.equal(actualChunks, expectChunks,
- "chunks=" + expectChunks + " writeSize=" + writeSize)
-
- // wait for all the timeout checks to finish, then end the test
- setTimeout(function WAIT () {
- if (timeouts > 0) return setTimeout(WAIT)
- t.end()
- }, 100)
- })
-
- for (var i = 0; i < writeCount; i ++) {
- var a = new Buffer(writeSize);
- for (var j = 0; j < writeSize; j ++) a[j] = "a".charCodeAt(0)
- var b = new Buffer(writeSize);
- for (var j = 0; j < writeSize; j ++) b[j] = "b".charCodeAt(0)
- f.write(a)
- f.write(b)
- }
- f.end()
- })
-}) }) })