mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
judge: testlib: support quitp
This commit is contained in:
1 parent
635776c86a
commit
fe103d3594
3 files changed
+14
-6
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "2.8.14",
|
||||
"version": "2.8.15",
|
||||
"main": "package.json",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -50,7 +50,7 @@ function judgeCase(c) {
|
||||
status = result.status;
|
||||
score = result.score;
|
||||
message = result.message;
|
||||
if (resInteractor.code && resInteractor.code !== 1) message += ` (Interactor exited with code ${resInteractor.code})`;
|
||||
if (resInteractor.code && !(resInteractor.stderr || '').trim().length) message += ` (Interactor exited with code ${resInteractor.code})`;
|
||||
}
|
||||
ctxSubtask.score = Score[ctxSubtask.subtask.type](ctxSubtask.score, score);
|
||||
ctxSubtask.status = Math.max(ctxSubtask.status, status);
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as STATUS from './status';
|
||||
export function parse(output: string, fullscore: number) {
|
||||
let status = STATUS.STATUS_WRONG_ANSWER;
|
||||
let score = 0;
|
||||
let message = '';
|
||||
let message = output;
|
||||
if (output.startsWith('ok ')) {
|
||||
status = STATUS.STATUS_ACCEPTED;
|
||||
score = fullscore;
|
||||
@@ -11,14 +11,22 @@ export function parse(output: string, fullscore: number) {
|
||||
message = output.split('wrong answer ')[1] || '';
|
||||
} else if (output.startsWith('wrong output format ')) {
|
||||
message = `PE ${output.split('wrong output format ')[1] || ''}`;
|
||||
} else if (output.startsWith('unexpected eof ')) {
|
||||
message = `UE ${output.split('unexpected eof ')[1] || ''}`;
|
||||
} else if (output.startsWith('partially correct ')) {
|
||||
message = `PC ${output.split('partially correct ')[1] || ''}`;
|
||||
const p = +output.split('partially correct (')[1].split(')')[0];
|
||||
score = Math.floor(fullscore * (p / 200));
|
||||
} else if (output.startsWith('points ')) {
|
||||
const p = +output.split('points ')[1].split(' ')[0];
|
||||
if (p === 100) {
|
||||
status = STATUS.STATUS_ACCEPTED;
|
||||
score = fullscore;
|
||||
const base = output.split('points ')[1] || '';
|
||||
message = base.substr(base.indexOf(' '), 1024);
|
||||
} else {
|
||||
message = `partially correct ${output.split('points ')[1] || ''}`;
|
||||
score = Math.floor(fullscore * (p / 100));
|
||||
}
|
||||
} else if (output.startsWith('FAIL ')) {
|
||||
message = output.split('FAIL ')[1] || '';
|
||||
status = STATUS.STATUS_SYSTEM_ERROR;
|
||||
}
|
||||
return { status, score, message };
|
||||
|
||||
Reference in new issue
Block a user