2021-11-01 22:33:16 +08:00
|
|
|
#include "problemcasevalidator.h"
|
|
|
|
#include "../utils.h"
|
|
|
|
|
|
|
|
ProblemCaseValidator::ProblemCaseValidator()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ProblemCaseValidator::validate(POJProblemCase problemCase)
|
|
|
|
{
|
|
|
|
if (!problemCase)
|
|
|
|
return false;
|
2021-11-12 10:51:00 +08:00
|
|
|
QStringList output = textToLines(problemCase->output);
|
|
|
|
QStringList expected = textToLines(problemCase->expected);
|
2021-11-01 22:33:16 +08:00
|
|
|
if (output.count()!=expected.count())
|
|
|
|
return false;
|
|
|
|
for (int i=0;i<output.count();i++) {
|
|
|
|
if (output[i]!=expected[i])
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|