mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: add user_code
This commit is contained in:
4 files changed
+7
-2
No files matched your search
@@ -10,6 +10,7 @@ export interface CheckConfig {
|
|||||||
output: CopyInFile;
|
output: CopyInFile;
|
||||||
user_stdout: CopyInFile;
|
user_stdout: CopyInFile;
|
||||||
user_stderr: CopyInFile;
|
user_stderr: CopyInFile;
|
||||||
|
code: CopyInFile;
|
||||||
copyIn: Record<string, CopyInFile>;
|
copyIn: Record<string, CopyInFile>;
|
||||||
score: number;
|
score: number;
|
||||||
detail: boolean;
|
detail: boolean;
|
||||||
@@ -176,7 +177,7 @@ const checkers: Record<string, Checker> = new Proxy({
|
|||||||
* input:输入
|
* input:输入
|
||||||
* user_out:选手输出
|
* user_out:选手输出
|
||||||
* answer:标准输出
|
* answer:标准输出
|
||||||
* code:选手代码 (not impl)
|
* code:选手代码
|
||||||
* stdout:输出最终得分
|
* stdout:输出最终得分
|
||||||
* stderr:输出错误报告
|
* stderr:输出错误报告
|
||||||
*/
|
*/
|
||||||
@@ -187,7 +188,7 @@ const checkers: Record<string, Checker> = new Proxy({
|
|||||||
input: config.input,
|
input: config.input,
|
||||||
user_out: config.user_stdout,
|
user_out: config.user_stdout,
|
||||||
answer: config.output,
|
answer: config.output,
|
||||||
code: { content: '' },
|
code: config.code,
|
||||||
...config.copyIn,
|
...config.copyIn,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -203,6 +204,7 @@ const checkers: Record<string, Checker> = new Proxy({
|
|||||||
in: config.input,
|
in: config.input,
|
||||||
user_out: config.user_stdout,
|
user_out: config.user_stdout,
|
||||||
answer: config.output,
|
answer: config.output,
|
||||||
|
user_code: config.code,
|
||||||
...config.copyIn,
|
...config.copyIn,
|
||||||
},
|
},
|
||||||
env: config.env,
|
env: config.env,
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ function judgeCase(c: NormalizedCase) {
|
|||||||
({ status, score, message } = await checkers[ctx.config.checker_type]({
|
({ status, score, message } = await checkers[ctx.config.checker_type]({
|
||||||
execute: ctx.checker.execute,
|
execute: ctx.checker.execute,
|
||||||
copyIn: ctx.checker.copyIn || {},
|
copyIn: ctx.checker.copyIn || {},
|
||||||
|
code: ctx.code,
|
||||||
input: { src: c.input },
|
input: { src: c.input },
|
||||||
output: { src: c.output },
|
output: { src: c.output },
|
||||||
user_stdout: fileIds.stdout ? { fileId: fileIds.stdout } : { content: '' },
|
user_stdout: fileIds.stdout ? { fileId: fileIds.stdout } : { content: '' },
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ export async function judge(ctx: Context) {
|
|||||||
output: { content: '' },
|
output: { content: '' },
|
||||||
user_stdout: res.fileIds.stdout ? { fileId: res.fileIds.stdout } : { content: '' },
|
user_stdout: res.fileIds.stdout ? { fileId: res.fileIds.stdout } : { content: '' },
|
||||||
user_stderr: { fileId: res.fileIds.stderr },
|
user_stderr: { fileId: res.fileIds.stderr },
|
||||||
|
code: ctx.code,
|
||||||
score: 100,
|
score: 100,
|
||||||
detail: ctx.config.detail ?? true,
|
detail: ctx.config.detail ?? true,
|
||||||
env: { ...ctx.env, HYDRO_TESTCASE: '0' },
|
env: { ...ctx.env, HYDRO_TESTCASE: '0' },
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ function judgeCase(c: NormalizedCase) {
|
|||||||
output: { src: c.output },
|
output: { src: c.output },
|
||||||
user_stdout: file,
|
user_stdout: file,
|
||||||
user_stderr: { content: '' },
|
user_stderr: { content: '' },
|
||||||
|
code: ctx.code,
|
||||||
score: c.score,
|
score: c.score,
|
||||||
detail: ctx.config.detail ?? true,
|
detail: ctx.config.detail ?? true,
|
||||||
env: { ...ctx.env, HYDRO_TESTCASE: c.id.toString() },
|
env: { ...ctx.env, HYDRO_TESTCASE: c.id.toString() },
|
||||||
|
|||||||
Reference in new issue
Block a user