From 1479a00cad7efafbbd76229287bd3ade8b154721 Mon Sep 17 00:00:00 2001 From: undefined Date: Wed, 23 Mar 2022 16:24:58 +0800 Subject: [PATCH] judge: fix testcase matching for inputX.txt --- packages/hydrojudge/package.json | 2 +- packages/hydrojudge/src/cases.ts | 4 ++-- packages/hydrojudge/src/hosts/hydro.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index 3c921b64..e0a1b91f 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -1,7 +1,7 @@ { "name": "@hydrooj/hydrojudge", "bin": "bin/hydrojudge.js", - "version": "2.14.7", + "version": "2.14.8", "main": "package.json", "author": "undefined ", "repository": "https://github.com/hydro-dev/Hydro.git", diff --git a/packages/hydrojudge/src/cases.ts b/packages/hydrojudge/src/cases.ts index 3383a496..488f223b 100644 --- a/packages/hydrojudge/src/cases.ts +++ b/packages/hydrojudge/src/cases.ts @@ -25,7 +25,7 @@ const RE0: Re0[] = [ (a) => `${a[1] + a[2]}.out`, (a) => `${a[1] + a[2]}.ans`, (a) => `${a[1] + a[2]}.out`.replace(/input/g, 'output'), - (a) => `${a[1] + a[2]}.txt`.replace(/input/g, 'output'), + (a) => (a[1].includes('input') ? `${a[1] + a[2]}.txt`.replace(/input/g, 'output') : null), ], id: (a) => +a[2], }, @@ -57,7 +57,7 @@ async function read0(folder: string, files: string[], checkFile, cfg) { for (const func of REG.output) { if (cfg.noOutputFile) c.output = '/dev/null'; else c.output = func(data); - if (c.output === '/dev/null' || fs.existsSync(path.resolve(folder, c.output))) { + if (c.output && (c.output === '/dev/null' || fs.existsSync(path.resolve(folder, c.output)))) { cases.push(c); break; } diff --git a/packages/hydrojudge/src/hosts/hydro.ts b/packages/hydrojudge/src/hosts/hydro.ts index f5b5beef..fc9ef47c 100644 --- a/packages/hydrojudge/src/hosts/hydro.ts +++ b/packages/hydrojudge/src/hosts/hydro.ts @@ -180,7 +180,7 @@ export default class Hydro { async init() { await this.setCookie(this.config.cookie || ''); await this.ensureLogin(); - setInterval(() => { this.axios.get('judge/noop'); }, 30000000); + setInterval(() => { this.axios.get(''); }, 30000000); // Cookie refresh only } async cacheOpen(source: string, files: any[], next?) {