2019-05-14 18:48:48 -04:00
|
|
|
'use strict';
|
|
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
|
|
};
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
var fs_1 = __importDefault(require("fs"));
|
|
|
|
var path_1 = __importDefault(require("path"));
|
|
|
|
var browserify_zlib_1 = __importDefault(require("browserify-zlib"));
|
2019-11-23 21:38:13 +09:00
|
|
|
var random_1 = require("./random");
|
|
|
|
exports.randomBytes = random_1.randomBytes;
|
|
|
|
exports.randomHexString = random_1.randomHexString;
|
|
|
|
exports.randomNumber = random_1.randomNumber;
|
2019-05-14 18:48:48 -04:00
|
|
|
function saveTests(tag, data) {
|
|
|
|
//let filename = path.resolve(__dirname, 'testcases', tag + '.json.gz');
|
2020-01-06 19:00:55 -05:00
|
|
|
var filename = path_1.default.resolve(__dirname, '../testcases', tag + '.json.gz');
|
2019-05-14 18:48:48 -04:00
|
|
|
fs_1.default.writeFileSync(filename, browserify_zlib_1.default.gzipSync(JSON.stringify(data, undefined, ' ') + '\n'));
|
|
|
|
console.log('Save testcase: ' + filename);
|
|
|
|
}
|
|
|
|
exports.saveTests = saveTests;
|
|
|
|
function loadTests(tag) {
|
2019-08-25 02:39:20 -04:00
|
|
|
var filename = path_1.default.resolve(__dirname, '../testcases', tag + '.json.gz');
|
2019-05-14 18:48:48 -04:00
|
|
|
return JSON.parse(browserify_zlib_1.default.gunzipSync(fs_1.default.readFileSync(filename)).toString());
|
|
|
|
}
|
|
|
|
exports.loadTests = loadTests;
|
|
|
|
function loadData(filename) {
|
|
|
|
return fs_1.default.readFileSync(path_1.default.resolve(__dirname, filename));
|
|
|
|
}
|
|
|
|
exports.loadData = loadData;
|
2020-07-13 08:03:56 -04:00
|
|
|
//# sourceMappingURL=index.js.map
|