2019-08-25 02:39:20 -04:00
|
|
|
'use strict';
|
|
|
|
import fs from 'fs';
|
|
|
|
import path from 'path';
|
|
|
|
import zlib from 'browserify-zlib';
|
2019-11-23 21:38:13 +09:00
|
|
|
import { randomBytes, randomHexString, randomNumber } from "./random";
|
|
|
|
export { randomBytes, randomHexString, randomNumber };
|
2019-08-25 02:39:20 -04:00
|
|
|
export function saveTests(tag, data) {
|
|
|
|
//let filename = path.resolve(__dirname, 'testcases', tag + '.json.gz');
|
2020-01-06 19:00:55 -05:00
|
|
|
let filename = path.resolve(__dirname, '../testcases', tag + '.json.gz');
|
2019-08-25 02:39:20 -04:00
|
|
|
fs.writeFileSync(filename, zlib.gzipSync(JSON.stringify(data, undefined, ' ') + '\n'));
|
|
|
|
console.log('Save testcase: ' + filename);
|
|
|
|
}
|
|
|
|
export function loadTests(tag) {
|
2019-08-25 16:20:34 -04:00
|
|
|
let filename = path.resolve(__dirname, '../testcases', tag + '.json.gz');
|
2019-08-25 02:39:20 -04:00
|
|
|
return JSON.parse(zlib.gunzipSync(fs.readFileSync(filename)).toString());
|
|
|
|
}
|
|
|
|
export function loadData(filename) {
|
|
|
|
return fs.readFileSync(path.resolve(__dirname, filename));
|
|
|
|
}
|
2020-07-13 08:03:56 -04:00
|
|
|
//# sourceMappingURL=index.js.map
|