Browse Source

Fix NaN detection.

master
t123yh 7 years ago
parent
commit
0ccdc6d37d
  1. 2
      src/daemon/judge/judger-base.ts
  2. 2
      src/runner/judge.ts

2
src/daemon/judge/judger-base.ts

@ -71,7 +71,7 @@ export abstract class JudgerBase {
currentTaskResult.errorMessage = err.toString(); currentTaskResult.errorMessage = err.toString();
winston.warn(`Task runner error: ${err.toString()} (subtask ${subtaskIndex}, case ${index})`); winston.warn(`Task runner error: ${err.toString()} (subtask ${subtaskIndex}, case ${index})`);
} }
if (score === 0 || score === NaN) { if (score == null || isNaN(score) || score === 0) {
winston.debug(`Subtask ${subtaskIndex}, case ${index}: zero, skipping the rest.`); winston.debug(`Subtask ${subtaskIndex}, case ${index}: zero, skipping the rest.`);
skipped = true; skipped = true;
} }

2
src/runner/judge.ts

@ -46,7 +46,7 @@ async function runSpj(spjBinDir: string, spjLanguage: Language): Promise<SpjResu
score = Number(scoreString); score = Number(scoreString);
const messageString = await readFileLength(pathLib.join(spjWorkingDir, messageFileName), Cfg.stderrDisplayLimit); const messageString = await readFileLength(pathLib.join(spjWorkingDir, messageFileName), Cfg.stderrDisplayLimit);
if ((!scoreString) || score === NaN || score < 0 || score > spjFullScore) { if ((!scoreString) || isNaN(score) || score < 0 || score > spjFullScore) {
return { return {
status: TestcaseResultType.JudgementFailed, status: TestcaseResultType.JudgementFailed,
message: `Special Judge returned an unrecoginzed score: ${scoreString}.`, message: `Special Judge returned an unrecoginzed score: ${scoreString}.`,

Loading…
Cancel
Save