38 lines
1.7 KiB
JavaScript
38 lines
1.7 KiB
JavaScript
'use strict';
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
result["default"] = mod;
|
|
return result;
|
|
};
|
|
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"));
|
|
var random_1 = require("./random");
|
|
exports.randomBytes = random_1.randomBytes;
|
|
exports.randomHexString = random_1.randomHexString;
|
|
exports.randomNumber = random_1.randomNumber;
|
|
var TestCase = __importStar(require("./testcases"));
|
|
exports.TestCase = TestCase;
|
|
function saveTests(tag, data) {
|
|
//let filename = path.resolve(__dirname, 'testcases', tag + '.json.gz');
|
|
var filename = path_1.default.resolve(__dirname, '../testcases', tag + '.json.gz');
|
|
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) {
|
|
var filename = path_1.default.resolve(__dirname, '../testcases', tag + '.json.gz');
|
|
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;
|
|
//# sourceMappingURL=index.js.map
|