pass json -> binary -> json test
This commit is contained in:
parent
e0af1007c7
commit
49b588c7a6
|
@ -61,8 +61,8 @@ function testBinAsync(nb) {
|
||||||
process.exit(38);
|
process.exit(38);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var bin = dnsjs.write(json);
|
var bin2 = dnsjs.write(json);
|
||||||
var json2 = dnsjs.parse(bin);
|
var json2 = dnsjs.parse(bin2);
|
||||||
if (json2.error) {
|
if (json2.error) {
|
||||||
console.error(json2);
|
console.error(json2);
|
||||||
process.exit(37);
|
process.exit(37);
|
||||||
|
@ -70,7 +70,20 @@ function testBinAsync(nb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
json = JSON.parse(JSON.stringify());
|
// EXPLANATION:
|
||||||
|
// The strategy used for compression pointers has not yet been proven
|
||||||
|
// as deterministic... and we don't implement them anyway, so this may not be the same
|
||||||
|
json = JSON.parse(JSON.stringify(json)
|
||||||
|
.replace(/,"labels":.*?\]/, '')
|
||||||
|
.replace(/,"cpcount":\d+/, '')
|
||||||
|
);
|
||||||
|
json2 = JSON.parse(JSON.stringify(json2)
|
||||||
|
.replace(/,"labels":.*?\]/, '')
|
||||||
|
.replace(/,"cpcount":\d+/, '')
|
||||||
|
);
|
||||||
|
//json2 = JSON.parse(JSON.stringify(json2));
|
||||||
|
//console.log(json);
|
||||||
|
//console.log(json2);
|
||||||
assert.deepEqual(json, json2);
|
assert.deepEqual(json, json2);
|
||||||
|
|
||||||
console.log("[OK] binary -> JSON -> binary -> JSON");
|
console.log("[OK] binary -> JSON -> binary -> JSON");
|
||||||
|
|
Loading…
Reference in New Issue