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