2014-01-20 08:37:48 +00:00
|
|
|
/* vim: set ts=2: */
|
|
|
|
/*jshint loopfunc:true */
|
|
|
|
var SSF = require('../');
|
|
|
|
var fs = require('fs'), assert = require('assert');
|
|
|
|
var data = fs.readFileSync('./test/exp.tsv','utf8').split("\n");
|
|
|
|
function doit(d, headers) {
|
|
|
|
it(d[0], function() {
|
2014-02-11 19:20:34 +00:00
|
|
|
for(var w = 1; w < headers.length; ++w) {
|
2014-01-20 08:37:48 +00:00
|
|
|
var expected = d[w].replace("|", ""), actual;
|
2014-06-13 15:02:06 +00:00
|
|
|
try { actual = SSF.format(headers[w], parseFloat(d[0]), {}); } catch(e) { }
|
2014-01-20 08:37:48 +00:00
|
|
|
if(actual != expected && d[w][0] !== "|") throw [actual, expected, w, headers[w],d[0],d].join("|");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
describe('exponential formats', function() {
|
|
|
|
var headers = data[0].split("\t");
|
2014-02-11 19:20:34 +00:00
|
|
|
for(var j=1;j<data.length;++j) {
|
2014-01-20 08:37:48 +00:00
|
|
|
if(!data[j]) return;
|
|
|
|
doit(data[j].replace(/#{255}/g,"").split("\t"), headers);
|
|
|
|
}
|
|
|
|
});
|