fix(diff): cases not properly detected
Some checks failed
build / build (push) Has been cancelled

This commit is contained in:
李衍志523370910113 2025-05-21 22:36:12 +08:00
parent 391d61d006
commit 26df677b36
5 changed files with 105 additions and 138 deletions

View File

@ -166,19 +166,25 @@ def fix_diff(
task_path: Path, task_path: Path,
) -> None: ) -> None:
base_dir = JOJ3_CONFIG_ROOT / task_path.parent base_dir = JOJ3_CONFIG_ROOT / task_path.parent
valid_cases = ( # all intended testcases that is detected
(case, task_stage.cases[case])
for case in task_stage.cases
if case not in task_stage.skip
)
testcases = get_testcases(task_root, task_path) testcases = get_testcases(task_root, task_path)
# all testcases that is not specified in the toml config
default_cases = sorted( default_cases = sorted(
[ testcases.difference(
case [
for case in testcases casei
if any(case.endswith(other) for other in task_stage.cases) for casei in testcases
] if any(casei.endswith(casej) for casej in task_stage.cases)
]
)
) )
# those in toml config that is not skiped
valid_cases = [
(casej, task_stage.cases[casei])
for casei in task_stage.cases
for casej in testcases
if (casei not in task_stage.skip and casej.endswith(casei))
]
stage_cases = [] stage_cases = []
parser_cases = [] parser_cases = []
for case, case_stage in valid_cases: for case, case_stage in valid_cases:
@ -216,6 +222,7 @@ def fix_diff(
] ]
) )
parser_cases.append(parser_case) parser_cases.append(parser_case)
for case in default_cases: for case in default_cases:
cmd = result.OptionalCmd( cmd = result.OptionalCmd(
stdin=result.LocalFile(src=str(base_dir / f"{case}.in")) stdin=result.LocalFile(src=str(base_dir / f"{case}.in"))

View File

@ -705,22 +705,7 @@
"dataSegmentLimit": false, "dataSegmentLimit": false,
"addressSpaceLimit": false "addressSpaceLimit": false
}, },
"cases": [ "cases": []
{
"stdin": {
"src": "/home/tt/.config/joj/basic/case0.in"
},
"cpuLimit": 500000000,
"clockLimit": 1000000000,
"memoryLimit": 5242880
},
{
"stdin": {
"src": "/home/tt/.config/joj/basic/case1.in"
},
"memoryLimit": 5242880
}
]
} }
}, },
"parsers": [ "parsers": [
@ -728,32 +713,7 @@
"name": "diff", "name": "diff",
"with": { "with": {
"name": "diff", "name": "diff",
"cases": [ "cases": []
{
"outputs": [
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/basic/case0.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false
}
]
},
{
"outputs": [
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/basic/case1.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false
}
]
}
]
} }
}, },
{ {

View File

@ -84,50 +84,50 @@
}, },
{ {
"stdin": { "stdin": {
"src": "/home/tt/.config/joj/diff/case11.in" "src": "/home/tt/.config/joj/diff/task1/subtask1/case11.in"
}, },
"memoryLimit": 268435456 "memoryLimit": 268435456
}, },
{
"stdin": {
"src": "/home/tt/.config/joj/diff/case10.in"
},
"memoryLimit": 268435456
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/case5.in"
},
"memoryLimit": 268435456
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/case0.in"
}
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/case1.in"
}
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/case9.in"
}
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/task1/case5.in"
}
},
{ {
"stdin": { "stdin": {
"src": "/home/tt/.config/joj/diff/task1/subtask1/case10.in" "src": "/home/tt/.config/joj/diff/task1/subtask1/case10.in"
},
"memoryLimit": 268435456
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/task1/case5.in"
},
"memoryLimit": 268435456
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/case2.in"
} }
}, },
{ {
"stdin": { "stdin": {
"src": "/home/tt/.config/joj/diff/task1/subtask1/case11.in" "src": "/home/tt/.config/joj/diff/case3.in"
}
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/task1/case4.in"
}
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/task2/case6.in"
}
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/task2/case7.in"
}
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/task2/case8.in"
} }
} }
] ]
@ -180,7 +180,7 @@
{ {
"score": 92321, "score": 92321,
"fileName": "stdout", "fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/case11.out", "answerPath": "/home/tt/.config/joj/diff/task1/subtask1/case11.out",
"forceQuitOnDiff": false, "forceQuitOnDiff": false,
"alwaysHide": false, "alwaysHide": false,
"compareSpace": false "compareSpace": false
@ -192,7 +192,7 @@
{ {
"score": 823131, "score": 823131,
"fileName": "stdout", "fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/case10.out", "answerPath": "/home/tt/.config/joj/diff/task1/subtask1/case10.out",
"forceQuitOnDiff": false, "forceQuitOnDiff": false,
"alwaysHide": false, "alwaysHide": false,
"compareSpace": false "compareSpace": false
@ -204,54 +204,6 @@
{ {
"score": 2590, "score": 2590,
"fileName": "stdout", "fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/case5.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false
}
]
},
{
"outputs": [
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/case0.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false
}
]
},
{
"outputs": [
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/case1.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false
}
]
},
{
"outputs": [
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/case9.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false
}
]
},
{
"outputs": [
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/task1/case5.out", "answerPath": "/home/tt/.config/joj/diff/task1/case5.out",
"forceQuitOnDiff": false, "forceQuitOnDiff": false,
"alwaysHide": false, "alwaysHide": false,
@ -264,7 +216,7 @@
{ {
"score": 5, "score": 5,
"fileName": "stdout", "fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/task1/subtask1/case10.out", "answerPath": "/home/tt/.config/joj/diff/case2.out",
"forceQuitOnDiff": false, "forceQuitOnDiff": false,
"alwaysHide": false, "alwaysHide": false,
"compareSpace": false "compareSpace": false
@ -276,7 +228,55 @@
{ {
"score": 5, "score": 5,
"fileName": "stdout", "fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/task1/subtask1/case11.out", "answerPath": "/home/tt/.config/joj/diff/case3.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false
}
]
},
{
"outputs": [
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/task1/case4.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false
}
]
},
{
"outputs": [
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/task2/case6.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false
}
]
},
{
"outputs": [
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/task2/case7.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false
}
]
},
{
"outputs": [
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/task2/case8.out",
"forceQuitOnDiff": false, "forceQuitOnDiff": false,
"alwaysHide": false, "alwaysHide": false,
"compareSpace": false "compareSpace": false

View File

View File