feat(diff): auto detect testcases #13

Merged
张泊明518370910136 merged 8 commits from fix/diff into master 2025-05-15 17:47:09 +08:00
2 changed files with 40 additions and 40 deletions
Showing only changes of commit e775992e5d - Show all commits

View File

@ -173,7 +173,7 @@ def fix_diff(
)
testcases = get_testcases(task_root, task_path)
# TODO: better filter strategy
default_cases = list(filter(lambda x: x not in task_stage.cases, testcases))
default_cases = sorted(testcases.difference(task_stage.cases))
stage_cases = []
parser_cases = []
for case, case_stage in valid_cases:
@ -233,10 +233,10 @@ def fix_diff(
def get_testcases(
task_root: Path, task_path: Path
) -> List[str]: # basedir here should be task_conf.root / task_conf.path
testcases = []
) -> Set[str]: # basedir here should be task_conf.root / task_conf.path
testcases = set()
for testcases_path in (task_root / task_path).parent.glob("**/*.in"):
testcases.append(
testcases.add(
str(
testcases_path.relative_to((task_root / task_path).parent)
).removesuffix(".in")

View File

@ -86,6 +86,16 @@
"src": "/home/tt/.config/joj/diff/case3.in"
}
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/task1/subtask1/task5.in"
}
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/task1/subtask1/task6.in"
}
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/task1/task1.in"
@ -96,11 +106,6 @@
"src": "/home/tt/.config/joj/diff/task1/task2.in"
}
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/task2/task4.in"
}
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/task2/task3.in"
@ -108,12 +113,7 @@
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/task1/subtask1/task6.in"
}
},
{
"stdin": {
"src": "/home/tt/.config/joj/diff/task1/subtask1/task5.in"
"src": "/home/tt/.config/joj/diff/task2/task4.in"
}
}
]
@ -173,6 +173,30 @@
}
]
},
{
"outputs": [
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/task1/subtask1/task5.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false
}
]
},
{
"outputs": [
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/task1/subtask1/task6.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false
}
]
},
{
"outputs": [
{
@ -197,18 +221,6 @@
}
]
},
{
"outputs": [
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/task2/task4.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false
}
]
},
{
"outputs": [
{
@ -226,19 +238,7 @@
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/task1/subtask1/task6.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false
}
]
},
{
"outputs": [
{
"score": 5,
"fileName": "stdout",
"answerPath": "/home/tt/.config/joj/diff/task1/subtask1/task5.out",
"answerPath": "/home/tt/.config/joj/diff/task2/task4.out",
"forceQuitOnDiff": false,
"alwaysHide": false,
"compareSpace": false