| 1 | /* |
| 2 | * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) |
| 3 | * |
| 4 | * This program is free software: you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation, either version 3 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | #ifndef OJPROBLEMSET_H |
| 18 | #define OJPROBLEMSET_H |
| 19 | #include <QString> |
| 20 | #include <memory> |
| 21 | #include <QVector> |
| 22 | |
| 23 | enum class ProblemCaseTestState { |
| 24 | NotTested, |
| 25 | Testing, |
| 26 | Passed, |
| 27 | Failed |
| 28 | }; |
| 29 | |
| 30 | struct OJProblemCase { |
| 31 | QString name; |
| 32 | QString input; |
| 33 | QString expected; |
| 34 | QString inputFileName; |
| 35 | QString expectedOutputFileName; |
| 36 | ProblemCaseTestState testState; // no persistence |
| 37 | QString output; // no persistence |
| 38 | int runningTime; |
| 39 | int firstDiffLine; |
| 40 | int outputLineCounts; |
| 41 | int expectedLineCounts; |
| 42 | OJProblemCase(); |
| 43 | |
| 44 | public: |
| 45 | const QString &getId() const; |
| 46 | |
| 47 | private: |
| 48 | QString id; |
| 49 | }; |
| 50 | |
| 51 | using POJProblemCase = std::shared_ptr<OJProblemCase>; |
| 52 | |
| 53 | struct OJProblem { |
| 54 | QString name; |
| 55 | QString url; |
| 56 | QString description; |
| 57 | QString answerProgram; |
| 58 | QVector<POJProblemCase> cases; |
| 59 | }; |
| 60 | |
| 61 | using POJProblem = std::shared_ptr<OJProblem>; |
| 62 | |
| 63 | struct OJProblemSet { |
| 64 | QString name; |
| 65 | QVector<POJProblem> problems; |
| 66 | QString exportFilename; |
| 67 | }; |
| 68 | |
| 69 | using POJProblemSet = std::shared_ptr<OJProblemSet>; |
| 70 | |
| 71 | #endif // OJPROBLEMSET_H |
| 72 | |