mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-21 12:24:00 +01:00
IE fixes
This commit is contained in:
parent
b9171721f9
commit
81331bb248
4 changed files with 17 additions and 9 deletions
|
@ -42,6 +42,6 @@ module.exports = {
|
||||||
Z_UNKNOWN: 2,
|
Z_UNKNOWN: 2,
|
||||||
|
|
||||||
/* The deflate compression method */
|
/* The deflate compression method */
|
||||||
Z_DEFLATED: 8,
|
Z_DEFLATED: 8
|
||||||
//Z_NULL: null // Use -1 or null, depending on var type
|
//Z_NULL: null // Use -1 or null, depending on var type
|
||||||
};
|
};
|
|
@ -5,8 +5,7 @@ var TYPED_OK = (typeof Uint8Array !== 'undefined') &&
|
||||||
(typeof Uint16Array !== 'undefined') &&
|
(typeof Uint16Array !== 'undefined') &&
|
||||||
(typeof Uint32Array !== 'undefined');
|
(typeof Uint32Array !== 'undefined');
|
||||||
|
|
||||||
var _toString = Function.prototype.call.bind(Object.prototype.toString);
|
var isArray = Array.isArray || function (obj) { return Object.prototype.toString.call(obj) === '[object Array]'; };
|
||||||
var isArray = Array.isArray || function (obj) { return _toString(obj) === '[object Array]'; };
|
|
||||||
|
|
||||||
// For debug/testing. Set true to force use untyped arrays
|
// For debug/testing. Set true to force use untyped arrays
|
||||||
exports.forceUntyped = false;
|
exports.forceUntyped = false;
|
||||||
|
|
|
@ -5,10 +5,13 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="../../node_modules/mocha/mocha.css" />
|
<link rel="stylesheet" href="../../node_modules/mocha/mocha.css" />
|
||||||
<script src="../../node_modules/mocha/mocha.js"></script>
|
<script src="../../node_modules/mocha/mocha.js"></script>
|
||||||
<script src="../../node_modules/chai/chai.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
mocha.setup('bdd');
|
mocha.setup('bdd');
|
||||||
assert = chai.assert;
|
</script>
|
||||||
|
<script>
|
||||||
|
function assert(expr, msg) {
|
||||||
|
if (!expr) throw new Error(msg || 'failed');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
function assert(expr, msg) {
|
function assert(expr, msg) {
|
||||||
|
|
|
@ -6,10 +6,16 @@
|
||||||
|
|
||||||
var size = 100*1000;
|
var size = 100*1000;
|
||||||
|
|
||||||
var data_bin = Uint8Array ? new Uint8Array(size) : new Array(size);
|
var data_bin = (typeof Uint8Array !== 'undefined') ? new Uint8Array(size) : new Array(size);
|
||||||
|
|
||||||
for (var i=data_bin.length-1; i>=0; i--) { data_bin[i] = (Math.random(256)*256) & 0xff; }
|
for (var i=data_bin.length-1; i>=0; i--) { data_bin[i] = (Math.random(256)*256) & 0xff; }
|
||||||
|
|
||||||
|
var cmp = function (a, b) {
|
||||||
|
if (a.length !== b.length) { return false; }
|
||||||
|
for (var i=0, l=a.length; i<l; i++) { if (a[i] !== b[i]) { return false; } }
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
describe('Generic tests', function () {
|
describe('Generic tests', function () {
|
||||||
|
|
||||||
|
@ -18,9 +24,9 @@ describe('Generic tests', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('levels', function() {
|
it.skip('levels', function() {
|
||||||
assert.deepEqual(data_bin, pako.inflate(pako.deflate(data_bin)));
|
assert(cmp(data_bin, pako.inflate(pako.deflate(data_bin))));
|
||||||
assert.deepEqual(data_bin, pako.inflate(pako.deflate(data_bin, { level: 0 })));
|
assert(cmp(data_bin, pako.inflate(pako.deflate(data_bin, { level: 0 }))));
|
||||||
assert.deepEqual(data_bin, pako.inflate(pako.deflate(data_bin, { level: 1 })));
|
assert(cmp(data_bin, pako.inflate(pako.deflate(data_bin, { level: 1 }))));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue