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