works ave

This commit is contained in:
royqh1979@gmail.com 2021-11-01 22:33:16 +08:00
parent e82723c6f8
commit 0a7855281e
3 changed files with 37 additions and 0 deletions

View File

@ -36,6 +36,7 @@ SOURCES += \
parser/parserutils.cpp \ parser/parserutils.cpp \
parser/statementmodel.cpp \ parser/statementmodel.cpp \
problems/ojproblemset.cpp \ problems/ojproblemset.cpp \
problems/problemcasevalidator.cpp \
project.cpp \ project.cpp \
projectoptions.cpp \ projectoptions.cpp \
projecttemplate.cpp \ projecttemplate.cpp \
@ -157,6 +158,7 @@ HEADERS += \
platform.h \ platform.h \
problems/ojproblemset.h \ problems/ojproblemset.h \
problems/problemcasevalidator.h \ problems/problemcasevalidator.h \
problems/problemcasevalidator.h \
project.h \ project.h \
projectoptions.h \ projectoptions.h \
projecttemplate.h \ projecttemplate.h \

View File

@ -0,0 +1,22 @@
#include "problemcasevalidator.h"
#include "../utils.h"
ProblemCaseValidator::ProblemCaseValidator()
{
}
bool ProblemCaseValidator::validate(POJProblemCase problemCase)
{
if (!problemCase)
return false;
QStringList output = TextToLines(problemCase->output);
QStringList expected = TextToLines(problemCase->expected);
if (output.count()!=expected.count())
return false;
for (int i=0;i<output.count();i++) {
if (output[i]!=expected[i])
return false;
}
return true;
}

View File

@ -0,0 +1,13 @@
#ifndef PROBLEMCASEVALIDATOR_H
#define PROBLEMCASEVALIDATOR_H
#include "ojproblemset.h"
class ProblemCaseValidator
{
public:
ProblemCaseValidator();
bool validate(POJProblemCase problemCase);
};
#endif // PROBLEMCASEVALIDATOR_H