Skip to content

Instantly share code, notes, and snippets.

@kenany
Forked from dominictarr/rounding-problem.js
Last active December 20, 2015 22:48
Show Gist options
  • Save kenany/6207387 to your computer and use it in GitHub Desktop.
Save kenany/6207387 to your computer and use it in GitHub Desktop.
var assert = require('assert');
var Parser = require('jsonparse');
var p = new Parser();
var r = Math.random();
var times = 20;
while (times--) {
assert.equal(JSON.parse(JSON.stringify(r)), r, 'core JSON');
p.onValue = function(v) {
console.error('parsed', v);
assert.equal(v, r);
}
console.error('correct', r);
p.write(new Buffer(JSON.stringify([r])));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment