utils: add test for subtask matcher

This commit is contained in:
undefined committed 2023-12-13 07:51:03 +08:00
1 parent 76e2dcc21b
commit b83b2e792e
3 files changed
+67 -2

No files matched your search

+2 -1
View File
@@ -240,7 +240,7 @@ interface MatchRule {
const SubtaskMatcher: MatchRule[] = [
{
regex: /^(([A-Za-z0-9]*?)(?:(\d*)[-_])?(\d+))\.(in|txt)$/,
regex: /^(([A-Za-z0-9._-]*?)(?:(\d*)[-_])?(\d+))\.(in|txt)$/,
output: [
(a) => `${a[1]}.out`,
(a) => `${a[1]}.ans`,
@@ -332,6 +332,7 @@ export function readSubtasksFromFiles(files: string[], config) {
memory: config.memory,
type,
cases: [c],
id: sid,
};
} else if (!subtask[sid].cases) subtask[sid].cases = [c];
else subtask[sid].cases.push(c);