| 103 | } |
| 104 | |
| 105 | auto StatisticsBrowser::getTestcaseScoreChart(QList<TestCase *> testCaseList, |
| 106 | QList<QList<QList<int>>> scoreList, |
| 107 | QList<QList<QList<ResultState>>> resultList) -> QString { |
| 108 | QString buffer = ""; |
| 109 | buffer += "<table border=\"-1\">"; |
| 110 | buffer += |
| 111 | QString( |
| 112 | R"(<tr><th>%1</th><th>%2</th><th>%3</th><th colspan="2">%4</th><th colspan="2">%5</th><th colspan="2">%6</th><th>%7</th></tr>)") |
| 113 | .arg(tr("No.")) |
| 114 | .arg(tr("Input")) |
| 115 | .arg(tr("Output")) |
| 116 | .arg(tr("Pure")) |
| 117 | .arg(tr("Far")) |
| 118 | .arg(tr("Lost")) |
| 119 | .arg(tr("Average")); |
| 120 | |
| 121 | for (int i = 0; i < testCaseList.length(); i++) { |
| 122 | QStringList inFileList = testCaseList[i]->getInputFiles(); |
| 123 | QStringList outFileList = testCaseList[i]->getOutputFiles(); |
| 124 | int mxScore = testCaseList[i]->getFullScore(); |
| 125 | QList<int> miScoreRecord; |
| 126 | QList<int> miStatRecord; |
| 127 | |
| 128 | for (int j = 0; j < scoreList.length(); j++) { |
| 129 | miScoreRecord.append(mxScore); |
| 130 | miStatRecord.append(2); |
| 131 | } |
| 132 | |
| 133 | for (int j = 0; j < inFileList.length(); j++) { |
| 134 | int cntFail = 0; |
| 135 | int cntPati = 0; |
| 136 | int cntSucc = 0; |
| 137 | long long sumscore = 0; |
| 138 | |
| 139 | for (int k = 0; k < scoreList.length(); k++) { |
| 140 | int score = 0; |
| 141 | int statVal = 2; |
| 142 | ResultState stat = WrongAnswer; |
| 143 | |
| 144 | if (scoreList[k].length() > i && scoreList[k][i].length() > j) { |
| 145 | score = scoreList[k][i][j]; |
| 146 | stat = resultList[k][i][j]; |
| 147 | } |
| 148 | |
| 149 | if (stat == CorrectAnswer) |
| 150 | cntSucc++, statVal = 2; |
| 151 | else if (stat == PartlyCorrect) |
| 152 | cntPati++, statVal = 1; |
| 153 | else |
| 154 | cntFail++, statVal = 0; |
| 155 | |
| 156 | sumscore += score; |
| 157 | miScoreRecord[k] = qMin(miScoreRecord[k], score); |
| 158 | miStatRecord[k] = qMin(miStatRecord[k], statVal); |
| 159 | } |
| 160 | |
| 161 | buffer += "<tr>"; |
| 162 | buffer += "<td align=\"left\">" + QString("%1.%2").arg(i + 1).arg(j + 1) + "</td>"; |
nothing calls this directly
no test coverage detected