works ave
This commit is contained in:
parent
e82723c6f8
commit
0a7855281e
|
@ -36,6 +36,7 @@ SOURCES += \
|
|||
parser/parserutils.cpp \
|
||||
parser/statementmodel.cpp \
|
||||
problems/ojproblemset.cpp \
|
||||
problems/problemcasevalidator.cpp \
|
||||
project.cpp \
|
||||
projectoptions.cpp \
|
||||
projecttemplate.cpp \
|
||||
|
@ -157,6 +158,7 @@ HEADERS += \
|
|||
platform.h \
|
||||
problems/ojproblemset.h \
|
||||
problems/problemcasevalidator.h \
|
||||
problems/problemcasevalidator.h \
|
||||
project.h \
|
||||
projectoptions.h \
|
||||
projecttemplate.h \
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef PROBLEMCASEVALIDATOR_H
|
||||
#define PROBLEMCASEVALIDATOR_H
|
||||
|
||||
#include "ojproblemset.h"
|
||||
|
||||
class ProblemCaseValidator
|
||||
{
|
||||
public:
|
||||
ProblemCaseValidator();
|
||||
bool validate(POJProblemCase problemCase);
|
||||
};
|
||||
|
||||
#endif // PROBLEMCASEVALIDATOR_H
|
Loading…
Reference in New Issue