mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-05 11:20:58 +01:00
Enabled basic inflate tests
This commit is contained in:
parent
5370c1382d
commit
6b5edb3b34
2 changed files with 21 additions and 17 deletions
|
@ -131,7 +131,7 @@ function testDeflate(zlib_factory, pako_deflate, samples, options, callback) {
|
||||||
|
|
||||||
|
|
||||||
function testInflate(samples, options, callback) {
|
function testInflate(samples, options, callback) {
|
||||||
var name, data, deflated;
|
var name, data, deflated, inflated;
|
||||||
|
|
||||||
for (name in samples) {
|
for (name in samples) {
|
||||||
data = samples[name];
|
data = samples[name];
|
||||||
|
@ -139,15 +139,19 @@ function testInflate(samples, options, callback) {
|
||||||
|
|
||||||
// with untyped arrays
|
// with untyped arrays
|
||||||
pako_utils.forceUntyped = true;
|
pako_utils.forceUntyped = true;
|
||||||
if (cmpBuf(pako.inflate(deflated, options).result, data)) {
|
inflated = pako.inflate(deflated, options);
|
||||||
callback('Error in "' + name + '" - zlib result != pako result');
|
pako_utils.forceUntyped = false;
|
||||||
|
|
||||||
|
if (!cmpBuf(inflated, data)) {
|
||||||
|
callback('Error in "' + name + '" - inflate result != original');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// with typed arrays
|
// with typed arrays
|
||||||
pako_utils.forceUntyped = true;
|
inflated = pako.inflate(deflated, options);
|
||||||
if (cmpBuf(pako.inflate(deflated, options).result, data)) {
|
|
||||||
callback('Error in "' + name + '" - zlib result != pako result');
|
if (!cmpBuf(inflated, data)) {
|
||||||
|
callback('Error in "' + name + '" - inflate result != original');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ var pako = require('../index');
|
||||||
var samples = helpers.loadSamples();
|
var samples = helpers.loadSamples();
|
||||||
|
|
||||||
|
|
||||||
describe.skip('Inflate defaults', function () {
|
describe('Inflate defaults', function () {
|
||||||
|
|
||||||
it('inflate, no options', function(done) {
|
it('inflate, no options', function(done) {
|
||||||
testInflate(samples, {}, done);
|
testInflate(samples, {}, done);
|
||||||
|
@ -25,22 +25,22 @@ describe.skip('Inflate defaults', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe.skip('Inflate ungzip', function () {
|
describe('Inflate ungzip', function () {
|
||||||
var orig = samples.lorem_cat;
|
var orig = samples.lorem_cat;
|
||||||
var gzipped = pako.gzip(samples.lorem_cat);
|
var gzipped = pako.gzip(samples.lorem_cat);
|
||||||
|
|
||||||
it('ungzip with autodetect', function(done) {
|
it.skip('ungzip with autodetect', function(done) {
|
||||||
done(helpers.cmp(orig, pako.inflate(gzipped).result));
|
done(helpers.cmp(orig, pako.inflate(gzipped).result));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ungzip with method set directly', function(done) {
|
it.skip('ungzip with method set directly', function(done) {
|
||||||
done(helpers.cmp(orig, pako.inflate(gzipped, { windowBits: 15 + 16 }).result));
|
done(helpers.cmp(orig, pako.inflate(gzipped, { windowBits: 15 + 16 }).result));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe.skip('Inflate levels', function () {
|
describe('Inflate levels', function () {
|
||||||
|
|
||||||
it('level 9', function(done) {
|
it('level 9', function(done) {
|
||||||
testInflate(samples, { level: 9 }, done);
|
testInflate(samples, { level: 9 }, done);
|
||||||
|
@ -69,14 +69,14 @@ describe.skip('Inflate levels', function () {
|
||||||
it('level 1', function(done) {
|
it('level 1', function(done) {
|
||||||
testInflate(samples, { level: 1 }, done);
|
testInflate(samples, { level: 1 }, done);
|
||||||
});
|
});
|
||||||
it('level 0', function(done) {
|
it.skip('level 0', function(done) {
|
||||||
testInflate(samples, { level: 0 }, done);
|
testInflate(samples, { level: 0 }, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe.skip('Inflate windowBits', function () {
|
describe('Inflate windowBits', function () {
|
||||||
|
|
||||||
it('windowBits 15', function(done) {
|
it('windowBits 15', function(done) {
|
||||||
testInflate(samples, { windowBits: 15 }, done);
|
testInflate(samples, { windowBits: 15 }, done);
|
||||||
|
@ -99,13 +99,13 @@ describe.skip('Inflate windowBits', function () {
|
||||||
it('windowBits 9', function(done) {
|
it('windowBits 9', function(done) {
|
||||||
testInflate(samples, { windowBits: 9 }, done);
|
testInflate(samples, { windowBits: 9 }, done);
|
||||||
});
|
});
|
||||||
it('windowBits 8', function(done) {
|
it.skip('windowBits 8', function(done) {
|
||||||
testInflate(samples, { windowBits: 8 }, done);
|
testInflate(samples, { windowBits: 8 }, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe.skip('Inflate strategy', function () {
|
describe('Inflate strategy', function () {
|
||||||
|
|
||||||
it('Z_DEFAULT_STRATEGY', function(done) {
|
it('Z_DEFAULT_STRATEGY', function(done) {
|
||||||
testInflate(samples, { strategy: 0 }, done);
|
testInflate(samples, { strategy: 0 }, done);
|
||||||
|
@ -126,7 +126,7 @@ describe.skip('Inflate strategy', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe.skip('Inflate RAW', function () {
|
describe('Inflate RAW', function () {
|
||||||
// Since difference is only in rwapper, test for store/fast/slow methods are enougth
|
// Since difference is only in rwapper, test for store/fast/slow methods are enougth
|
||||||
it('level 4', function(done) {
|
it('level 4', function(done) {
|
||||||
testInflate(samples, { level: 4, raw: true }, done);
|
testInflate(samples, { level: 4, raw: true }, done);
|
||||||
|
@ -134,7 +134,7 @@ describe.skip('Inflate RAW', function () {
|
||||||
it('level 1', function(done) {
|
it('level 1', function(done) {
|
||||||
testInflate(samples, { level: 1, raw: true }, done);
|
testInflate(samples, { level: 1, raw: true }, done);
|
||||||
});
|
});
|
||||||
it('level 0', function(done) {
|
it.skip('level 0', function(done) {
|
||||||
testInflate(samples, { level: 0, raw: true }, done);
|
testInflate(samples, { level: 0, raw: true }, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue