Skip to content

Commit

Permalink
fix on linux and macos
Browse files Browse the repository at this point in the history
  • Loading branch information
Sukwants committed Nov 10, 2023
1 parent 28d4479 commit 2526704
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/judger.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function judge(file, data, solver, interactor, checker, timeLimit, allj) {

async function judger(file, data, options) {
try {
file = file || config.getValue('file', 'name'); // process answer file path (1/2)
file = file || config.getValue('file', 'name'); // process answer file path (1/3)
file = file.replace(/\.cpp$/, '');

compile(file, options, 'Answer'); // compile answer
Expand Down Expand Up @@ -94,7 +94,7 @@ async function judger(file, data, options) {
console.log(chalk.blue('[Notice]'), 'No tests detected.');
} else {

if (!path.isAbsolute(file) && !file.startsWith('./')) { // process answer file path (2/2)
if (!path.isAbsolute(file) && !file.startsWith('./')) { // process answer file path (2/3)
file = './' + file;
}
for (let i = 0; i < dataList.length; i++) { // erase .in suffix and sort
Expand All @@ -113,8 +113,11 @@ async function judger(file, data, options) {
} else {

data = (data || file).replace(/\.in$/, '');
if (!path.isAbsolute(file) && !file.startsWith('./')) { // process answer file path (3/3)
file = './' + file;
}
for (let i = 1; true; i++) {
const seed = generateRandomString(10);
const seed = generateRandomString(20);
console.log(chalk.bold(chalk.hex('#708090')(`Test #${i} (${seed}):`)));
generate(generator, `${data}.in`, i, seed);
console.log(chalk.hex('#708090')('Generated.'));
Expand All @@ -128,4 +131,4 @@ async function judger(file, data, options) {
}
}

module.exports = judger;
module.exports = judger;

0 comments on commit 2526704

Please sign in to comment.