Test serializer exit code

It returns 0, when the configurations identical and 1 otherwise.
This commit is contained in:
József Farkas
2016-08-15 22:14:52 +02:00
parent 1cb95840c9
commit cc246f27d9

View File

@@ -26,12 +26,21 @@ let config2BufferContent = config1Buffer.getBufferContent();
fs.writeFileSync('uhk-config-serialized.bin', config2BufferContent);
console.log('\n');
let error: boolean;
try {
assert.deepEqual(config1Js, config2Js);
console.log('JSON configurations are identical.');
} catch (error) {
console.log('JSON configurations differ.');
error = true;
}
let buffersContentsAreEqual = Buffer.compare(config1BufferContent, config2BufferContent) === 0;
console.log('Binary configurations ' + (buffersContentsAreEqual ? 'are identical' : 'differ') + '.');
const buffersContentsAreEqual: boolean = Buffer.compare(config1BufferContent, config2BufferContent) === 0;
if (buffersContentsAreEqual) {
console.log('Binary configurations are identical.');
} else {
console.log('Binary configurations differ.');
error = true;
}
process.exit(error ? 1 : 0);