Skip to content

Commit 17be5ed

Browse files
committed
tests_passed is added to report in all contest types
1 parent d438197 commit 17be5ed

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

lib/run_common.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,30 +261,25 @@ generate_xml_report(
261261
if (srgp->scoring_system_val == SCORE_OLYMPIAD) {
262262
tr->accepting_mode = (srgp->accepting_mode > 0);
263263
}
264+
tr->tests_passed = reply_pkt->tests_passed;
264265

265266
if (srgp->scoring_system_val == SCORE_OLYMPIAD && srgp->accepting_mode > 0 && reply_pkt->status != RUN_ACCEPTED) {
266-
tr->tests_passed = reply_pkt->tests_passed;
267267
tr->failed_test = total_tests - 1;
268268
} else if (srgp->scoring_system_val == SCORE_ACM && reply_pkt->status != RUN_OK) {
269-
tr->tests_passed = reply_pkt->tests_passed;
270269
tr->failed_test = total_tests - 1;
271270
} else if (srgp->scoring_system_val == SCORE_OLYMPIAD && srgp->accepting_mode <= 0) {
272-
tr->tests_passed = reply_pkt->tests_passed;
273271
tr->score = reply_pkt->score;
274272
tr->max_score = max_score;
275273
} else if (srgp->scoring_system_val == SCORE_KIROV) {
276-
tr->tests_passed = reply_pkt->tests_passed;
277274
tr->score = reply_pkt->score;
278275
tr->max_score = max_score;
279276
} else if (srgp->scoring_system_val == SCORE_MOSCOW) {
280277
if (reply_pkt->status != RUN_OK) {
281278
tr->failed_test = total_tests - 1;
282279
}
283-
tr->tests_passed = reply_pkt->tests_passed;
284280
tr->score = reply_pkt->score;
285281
tr->max_score = max_score;
286282
} else {
287-
tr->tests_passed = reply_pkt->tests_passed;
288283
}
289284
if (report_time_limit_ms > 0) {
290285
tr->time_limit_ms = report_time_limit_ms;

lib/testing_report_bson.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,9 @@ do_unparse(
888888
if (r->accepting_mode > 0) {
889889
bson_append_bool(b, tag_table[Tag_accepting_mode], -1, 1);
890890
}
891+
if (r->tests_passed >= 0) {
892+
bson_append_int32(b, tag_table[Tag_tests_passed], -1, r->tests_passed);
893+
}
891894
if (r->scoring_system == SCORE_OLYMPIAD && r->accepting_mode > 0 && r->status != RUN_ACCEPTED) {
892895
if (r->failed_test > 0) {
893896
bson_append_int32(b, tag_table[Tag_failed_test], -1, r->failed_test);
@@ -897,11 +900,9 @@ do_unparse(
897900
bson_append_int32(b, tag_table[Tag_failed_test], -1, r->failed_test);
898901
}
899902
} else if (r->scoring_system == SCORE_OLYMPIAD && r->accepting_mode <= 0) {
900-
bson_append_int32(b, tag_table[Tag_tests_passed], -1, r->tests_passed);
901903
bson_append_int32(b, tag_table[Tag_score], -1, r->score);
902904
bson_append_int32(b, tag_table[Tag_max_score], -1, r->max_score);
903905
} else if (r->scoring_system == SCORE_KIROV) {
904-
bson_append_int32(b, tag_table[Tag_tests_passed], -1, r->tests_passed);
905906
bson_append_int32(b, tag_table[Tag_score], -1, r->score);
906907
bson_append_int32(b, tag_table[Tag_max_score], -1, r->max_score);
907908
} else if (r->scoring_system == SCORE_MOSCOW) {

lib/testing_report_xml.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,13 +1632,11 @@ testing_report_unparse_xml(
16321632
fprintf(out, " %s=\"%d\"", attr_map[TR_A_FAILED_TEST], r->failed_test);
16331633
}
16341634
} else if (r->scoring_system == SCORE_OLYMPIAD && r->accepting_mode <= 0) {
1635-
fprintf(out, " %s=\"%d\" %s=\"%d\" %s=\"%d\"",
1636-
attr_map[TR_A_TESTS_PASSED], r->tests_passed,
1635+
fprintf(out, " %s=\"%d\" %s=\"%d\"",
16371636
attr_map[TR_A_SCORE], r->score,
16381637
attr_map[TR_A_MAX_SCORE], r->max_score);
16391638
} else if (r->scoring_system == SCORE_KIROV) {
1640-
fprintf(out, " %s=\"%d\" %s=\"%d\" %s=\"%d\"",
1641-
attr_map[TR_A_TESTS_PASSED], r->tests_passed,
1639+
fprintf(out, " %s=\"%d\" %s=\"%d\"",
16421640
attr_map[TR_A_SCORE], r->score,
16431641
attr_map[TR_A_MAX_SCORE], r->max_score);
16441642
} else if (r->scoring_system == SCORE_MOSCOW) {
@@ -1651,6 +1649,9 @@ testing_report_unparse_xml(
16511649
attr_map[TR_A_SCORE], r->score,
16521650
attr_map[TR_A_MAX_SCORE], r->max_score);
16531651
}
1652+
if (r->tests_passed >= 0) {
1653+
fprintf(out, " %s=\"%d\"", attr_map[TR_A_TESTS_PASSED], r->tests_passed);
1654+
}
16541655

16551656
if (r->time_limit_ms > 0) {
16561657
fprintf(out, " %s=\"%d\"", attr_map[TR_A_TIME_LIMIT_MS], r->time_limit_ms);

0 commit comments

Comments
 (0)