auto batch set problem case's expected file that has "ans" as the suffix
This commit is contained in:
parent
e7db1a3a6f
commit
97274a7e79
|
@ -3288,9 +3288,15 @@ void MainWindow::onProblemBatchSetCases()
|
||||||
problemCase->name = QFileInfo(filename).baseName();
|
problemCase->name = QFileInfo(filename).baseName();
|
||||||
problemCase->testState = ProblemCaseTestState::NotTested;
|
problemCase->testState = ProblemCaseTestState::NotTested;
|
||||||
problemCase->inputFileName = filename;
|
problemCase->inputFileName = filename;
|
||||||
QString expectedFileName = filename.mid(0,filename.length()-2)+"out";
|
QString expectedFileName;
|
||||||
|
expectedFileName = filename.mid(0,filename.length()-2)+"ans";
|
||||||
|
if (fileExists(expectedFileName)) {
|
||||||
|
problemCase->expectedOutputFileName = expectedFileName;
|
||||||
|
} else {
|
||||||
|
expectedFileName = filename.mid(0,filename.length()-2)+"out";
|
||||||
if (fileExists(expectedFileName))
|
if (fileExists(expectedFileName))
|
||||||
problemCase->expectedOutputFileName = expectedFileName;
|
problemCase->expectedOutputFileName = expectedFileName;
|
||||||
|
}
|
||||||
mOJProblemModel.addCase(problemCase);
|
mOJProblemModel.addCase(problemCase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7545,10 +7551,16 @@ void MainWindow::on_btnProblemCaseInputFileName_clicked()
|
||||||
if (problemCase->expectedOutputFileName.isEmpty()
|
if (problemCase->expectedOutputFileName.isEmpty()
|
||||||
&& problemCase->expected.isEmpty()
|
&& problemCase->expected.isEmpty()
|
||||||
&& QFileInfo(fileName).suffix()=="in") {
|
&& QFileInfo(fileName).suffix()=="in") {
|
||||||
QString expectedFileName = fileName.mid(0,fileName.length()-2)+"out";
|
QString expectedFileName;
|
||||||
|
expectedFileName = fileName.mid(0,fileName.length()-2)+"ans";
|
||||||
|
if (fileExists(expectedFileName)) {
|
||||||
|
problemCase->expectedOutputFileName = expectedFileName;
|
||||||
|
} else {
|
||||||
|
expectedFileName = fileName.mid(0,fileName.length()-2)+"out";
|
||||||
if (fileExists(expectedFileName))
|
if (fileExists(expectedFileName))
|
||||||
problemCase->expectedOutputFileName = expectedFileName;
|
problemCase->expectedOutputFileName = expectedFileName;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fillProblemCaseInputAndExpected(problemCase);
|
fillProblemCaseInputAndExpected(problemCase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue