From 1ad895275f8eaea97c1797b15c5ea7c81f65bbc1 Mon Sep 17 00:00:00 2001 From: Ashar Fuadi Date: Fri, 16 Aug 2024 21:56:05 +0700 Subject: [PATCH] grader: Beautify score output --- .../BatchGradingEngineIntegrationTests.java | 50 ++++---- ...SubtasksGradingEngineIntegrationTests.java | 114 +++++++++--------- ...nctionalGradingEngineIntegrationTests.java | 30 ++--- ...onalGradingEngineJavaIntegrationTests.java | 30 ++--- ...SubtasksGradingEngineIntegrationTests.java | 38 +++--- ...asksGradingEngineJavaIntegrationTests.java | 38 +++--- ...eractiveGradingEngineIntegrationTests.java | 70 +++++------ ...SubtasksGradingEngineIntegrationTests.java | 36 +++--- ...tputOnlyGradingEngineIntegrationTests.java | 50 ++++---- ...SubtasksGradingEngineIntegrationTests.java | 96 +++++++-------- .../gabriel/aggregators/MinAggregator.java | 8 +- .../gabriel/aggregators/PointUtils.java | 18 +++ .../gabriel/aggregators/SumAggregator.java | 2 +- .../aggregators/MinAggregatorTests.java | 16 +-- .../aggregators/SumAggregatorTests.java | 8 +- 15 files changed, 311 insertions(+), 293 deletions(-) create mode 100644 judgels-backends/judgels-grader-engines/src/main/java/judgels/gabriel/aggregators/PointUtils.java diff --git a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/batch/BatchGradingEngineIntegrationTests.java b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/batch/BatchGradingEngineIntegrationTests.java index 26114c598..9e3f34799 100644 --- a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/batch/BatchGradingEngineIntegrationTests.java +++ b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/batch/BatchGradingEngineIntegrationTests.java @@ -55,11 +55,11 @@ void ac() throws GradingException { testCaseResult(ACCEPTED, "", 0)), testGroupResult( -1, - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1))), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1))), ImmutableList.of( subtaskResult(-1, ACCEPTED, 100))); } @@ -79,11 +79,11 @@ void ac_but_wa_at_sample_that_is_not_included() throws GradingException { testCaseResult(WRONG_ANSWER, "", 0)), testGroupResult( -1, - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1))), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1))), ImmutableList.of( subtaskResult(-1, ACCEPTED, 100))); } @@ -103,11 +103,11 @@ void wa_80() throws GradingException { testCaseResult(ACCEPTED, "", 0)), testGroupResult( -1, - testCaseResult(WRONG_ANSWER, "0.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1))), + testCaseResult(WRONG_ANSWER, "0", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1))), ImmutableList.of( subtaskResult(-1, WRONG_ANSWER, 80))); } @@ -127,11 +127,11 @@ void wa_token_mismatch() throws GradingException { testCaseResult(WRONG_ANSWER, "", 0)), testGroupResult( -1, - testCaseResult(WRONG_ANSWER, "0.0", -1), - testCaseResult(WRONG_ANSWER, "0.0", -1), - testCaseResult(WRONG_ANSWER, "0.0", -1), - testCaseResult(WRONG_ANSWER, "0.0", -1), - testCaseResult(WRONG_ANSWER, "0.0", -1))), + testCaseResult(WRONG_ANSWER, "0", -1), + testCaseResult(WRONG_ANSWER, "0", -1), + testCaseResult(WRONG_ANSWER, "0", -1), + testCaseResult(WRONG_ANSWER, "0", -1), + testCaseResult(WRONG_ANSWER, "0", -1))), ImmutableList.of( subtaskResult(-1, WRONG_ANSWER, 0))); } @@ -151,11 +151,11 @@ void ok_90_with_custom_scorer() throws GradingException { testCaseResult(ACCEPTED, "", 0)), testGroupResult( -1, - testCaseResult(OK, "10.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1))), + testCaseResult(OK, "10", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1))), ImmutableList.of( subtaskResult(-1, OK, 90))); } diff --git a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/batch/BatchWithSubtasksGradingEngineIntegrationTests.java b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/batch/BatchWithSubtasksGradingEngineIntegrationTests.java index a9dd3291e..aab3cf716 100644 --- a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/batch/BatchWithSubtasksGradingEngineIntegrationTests.java +++ b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/batch/BatchWithSubtasksGradingEngineIntegrationTests.java @@ -52,18 +52,18 @@ void ac() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 2)), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", 1, 2), - testCaseResult(ACCEPTED, "*", 1, 2)), + testCaseResult(ACCEPTED, "✓", 1, 2), + testCaseResult(ACCEPTED, "✓", 1, 2)), testGroupResult( 2, - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(ACCEPTED, "*", 2))), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(ACCEPTED, "✓", 2))), ImmutableList.of( subtaskResult(1, ACCEPTED, 30), subtaskResult(2, ACCEPTED, 70))); @@ -79,18 +79,18 @@ void wa_30() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 2)), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", 1, 2), - testCaseResult(ACCEPTED, "*", 1, 2)), + testCaseResult(ACCEPTED, "✓", 1, 2), + testCaseResult(ACCEPTED, "✓", 1, 2)), testGroupResult( 2, - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(WRONG_ANSWER, "X", 2))), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(WRONG_ANSWER, "✕", 2))), ImmutableList.of( subtaskResult(1, ACCEPTED, 30), subtaskResult(2, WRONG_ANSWER, 0))); @@ -106,13 +106,13 @@ void wa_30_at_sample() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(WRONG_ANSWER, "X", 0, 2)), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(WRONG_ANSWER, "✕", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", 1, 2), - testCaseResult(ACCEPTED, "*", 1, 2)), + testCaseResult(ACCEPTED, "✓", 1, 2), + testCaseResult(ACCEPTED, "✓", 1, 2)), testGroupResult( 2, testCaseResult(SKIPPED, "?", Optional.empty(), 2), @@ -133,18 +133,18 @@ void tle_30() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 2)), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", 1, 2), - testCaseResult(ACCEPTED, "*", 1, 2)), + testCaseResult(ACCEPTED, "✓", 1, 2), + testCaseResult(ACCEPTED, "✓", 1, 2)), testGroupResult( 2, - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(TIME_LIMIT_EXCEEDED, "X", Optional.of(TIMED_OUT), 2))), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(TIME_LIMIT_EXCEEDED, "✕", Optional.of(TIMED_OUT), 2))), ImmutableList.of( subtaskResult(1, ACCEPTED, 30), subtaskResult(2, TIME_LIMIT_EXCEEDED, 0))); @@ -160,12 +160,12 @@ void wa_0() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 2)), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 2)), testGroupResult( 1, - testCaseResult(WRONG_ANSWER, "X", 1, 2), + testCaseResult(WRONG_ANSWER, "✕", 1, 2), testCaseResult(SKIPPED, "?", Optional.empty(), 1, 2)), testGroupResult( 2, @@ -187,18 +187,18 @@ void ac_with_custom_scorer() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 2)), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", 1, 2), - testCaseResult(ACCEPTED, "*", 1, 2)), + testCaseResult(ACCEPTED, "✓", 1, 2), + testCaseResult(ACCEPTED, "✓", 1, 2)), testGroupResult( 2, - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(ACCEPTED, "*", 2))), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(ACCEPTED, "✓", 2))), ImmutableList.of( subtaskResult(1, ACCEPTED, 30), subtaskResult(2, ACCEPTED, 70))); @@ -215,18 +215,18 @@ void ok_minimum_score_with_custom_scorer() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 2)), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", 1, 2), - testCaseResult(ACCEPTED, "*", 1, 2)), + testCaseResult(ACCEPTED, "✓", 1, 2), + testCaseResult(ACCEPTED, "✓", 1, 2)), testGroupResult( 2, - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(OK, "10.0", 2))), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(OK, "10", 2))), ImmutableList.of( subtaskResult(1, ACCEPTED, 30), subtaskResult(2, OK, 10))); @@ -242,18 +242,18 @@ void wa_30_with_custom_scorer() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 2)), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", 1, 2), - testCaseResult(ACCEPTED, "*", 1, 2)), + testCaseResult(ACCEPTED, "✓", 1, 2), + testCaseResult(ACCEPTED, "✓", 1, 2)), testGroupResult( 2, - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(WRONG_ANSWER, "X", 2))), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(WRONG_ANSWER, "✕", 2))), ImmutableList.of( subtaskResult(1, ACCEPTED, 30), subtaskResult(2, WRONG_ANSWER, 0))); diff --git a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalGradingEngineIntegrationTests.java b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalGradingEngineIntegrationTests.java index f9e070232..22094ccff 100644 --- a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalGradingEngineIntegrationTests.java +++ b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalGradingEngineIntegrationTests.java @@ -53,11 +53,11 @@ void ac() throws GradingException { testCaseResult(ACCEPTED, "", 0)), testGroupResult( -1, - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1))), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1))), ImmutableList.of( subtaskResult(-1, ACCEPTED, 100))); } @@ -78,11 +78,11 @@ void wa_80() throws GradingException { testCaseResult(ACCEPTED, "", 0)), testGroupResult( -1, - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(WRONG_ANSWER, "0.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1))), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(WRONG_ANSWER, "0", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1))), ImmutableList.of( subtaskResult(-1, WRONG_ANSWER, 80))); } @@ -104,11 +104,11 @@ void ok_90_with_custom_scorer() throws GradingException { testCaseResult(ACCEPTED, "", 0)), testGroupResult( -1, - testCaseResult(OK, "10.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1))), + testCaseResult(OK, "10", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1))), ImmutableList.of( subtaskResult(-1, OK, 90))); } diff --git a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalGradingEngineJavaIntegrationTests.java b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalGradingEngineJavaIntegrationTests.java index ef4e0811f..a421321f2 100644 --- a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalGradingEngineJavaIntegrationTests.java +++ b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalGradingEngineJavaIntegrationTests.java @@ -56,11 +56,11 @@ void ac() throws GradingException { testCaseResult(ACCEPTED, "", 0)), testGroupResult( -1, - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1))), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1))), ImmutableList.of( subtaskResult(-1, ACCEPTED, 100))); } @@ -83,11 +83,11 @@ void wa_80() throws GradingException { testCaseResult(ACCEPTED, "", 0)), testGroupResult( -1, - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(WRONG_ANSWER, "0.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1))), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(WRONG_ANSWER, "0", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1))), ImmutableList.of( subtaskResult(-1, WRONG_ANSWER, 80))); } @@ -111,11 +111,11 @@ void ok_90_with_custom_scorer() throws GradingException { testCaseResult(ACCEPTED, "", 0)), testGroupResult( -1, - testCaseResult(OK, "10.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1))), + testCaseResult(OK, "10", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1))), ImmutableList.of( subtaskResult(-1, OK, 90))); } diff --git a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalWithSubtasksGradingEngineIntegrationTests.java b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalWithSubtasksGradingEngineIntegrationTests.java index c13bdcba1..b6ccacbd3 100644 --- a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalWithSubtasksGradingEngineIntegrationTests.java +++ b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalWithSubtasksGradingEngineIntegrationTests.java @@ -47,18 +47,18 @@ void ac() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 2)), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", 1, 2), - testCaseResult(ACCEPTED, "*", 1, 2)), + testCaseResult(ACCEPTED, "✓", 1, 2), + testCaseResult(ACCEPTED, "✓", 1, 2)), testGroupResult( 2, - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(ACCEPTED, "*", 2))), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(ACCEPTED, "✓", 2))), ImmutableList.of( subtaskResult(1, ACCEPTED, 30), subtaskResult(2, ACCEPTED, 70))); @@ -75,13 +75,13 @@ void wa_30() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 2)), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", 1, 2), - testCaseResult(ACCEPTED, "*", 1, 2)), + testCaseResult(ACCEPTED, "✓", 1, 2), + testCaseResult(ACCEPTED, "✓", 1, 2)), testGroupResult( 2, testCaseResult(WRONG_ANSWER, "X", 2), @@ -104,16 +104,16 @@ void wa_30_with_custom_scorer() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 2)), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", 1, 2), - testCaseResult(ACCEPTED, "*", 1, 2)), + testCaseResult(ACCEPTED, "✓", 1, 2), + testCaseResult(ACCEPTED, "✓", 1, 2)), testGroupResult( 2, - testCaseResult(WRONG_ANSWER, "X", 2), + testCaseResult(WRONG_ANSWER, "✕", 2), testCaseResult(SKIPPED, "?", Optional.empty(), 2), testCaseResult(SKIPPED, "?", Optional.empty(), 2))), ImmutableList.of( diff --git a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalWithSubtasksGradingEngineJavaIntegrationTests.java b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalWithSubtasksGradingEngineJavaIntegrationTests.java index 32fa75198..9bc475b2c 100644 --- a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalWithSubtasksGradingEngineJavaIntegrationTests.java +++ b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/functional/FunctionalWithSubtasksGradingEngineJavaIntegrationTests.java @@ -50,18 +50,18 @@ void ac() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 2)), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", 1, 2), - testCaseResult(ACCEPTED, "*", 1, 2)), + testCaseResult(ACCEPTED, "✓", 1, 2), + testCaseResult(ACCEPTED, "✓", 1, 2)), testGroupResult( 2, - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(ACCEPTED, "*", 2), - testCaseResult(ACCEPTED, "*", 2))), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(ACCEPTED, "✓", 2), + testCaseResult(ACCEPTED, "✓", 2))), ImmutableList.of( subtaskResult(1, ACCEPTED, 30), subtaskResult(2, ACCEPTED, 70))); @@ -80,16 +80,16 @@ void wa_30() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 2)), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", 1, 2), - testCaseResult(ACCEPTED, "*", 1, 2)), + testCaseResult(ACCEPTED, "✓", 1, 2), + testCaseResult(ACCEPTED, "✓", 1, 2)), testGroupResult( 2, - testCaseResult(WRONG_ANSWER, "X", 2), + testCaseResult(WRONG_ANSWER, "✕", 2), testCaseResult(SKIPPED, "?", Optional.empty(), 2), testCaseResult(SKIPPED, "?", Optional.empty(), 2))), ImmutableList.of( @@ -111,13 +111,13 @@ void wa_30_with_custom_scorer() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 1, 2), - testCaseResult(ACCEPTED, "*", 0, 2)), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 1, 2), + testCaseResult(ACCEPTED, "✓", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", 1, 2), - testCaseResult(ACCEPTED, "*", 1, 2)), + testCaseResult(ACCEPTED, "✓", 1, 2), + testCaseResult(ACCEPTED, "✓", 1, 2)), testGroupResult( 2, testCaseResult(WRONG_ANSWER, "X", 2), diff --git a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/interactive/InteractiveGradingEngineIntegrationTests.java b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/interactive/InteractiveGradingEngineIntegrationTests.java index 200adb321..569f70611 100644 --- a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/interactive/InteractiveGradingEngineIntegrationTests.java +++ b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/interactive/InteractiveGradingEngineIntegrationTests.java @@ -59,11 +59,11 @@ void ac() throws GradingException { testCaseResult(ACCEPTED, "[10]", 0)), testGroupResult( -1, - testCaseResult(ACCEPTED, "20.0 [9]", -1), - testCaseResult(ACCEPTED, "20.0 [10]", -1), - testCaseResult(ACCEPTED, "20.0 [10]", -1), - testCaseResult(ACCEPTED, "20.0 [9]", -1), - testCaseResult(ACCEPTED, "20.0 [1]", -1))), + testCaseResult(ACCEPTED, "20 [9]", -1), + testCaseResult(ACCEPTED, "20 [10]", -1), + testCaseResult(ACCEPTED, "20 [10]", -1), + testCaseResult(ACCEPTED, "20 [9]", -1), + testCaseResult(ACCEPTED, "20 [1]", -1))), ImmutableList.of( subtaskResult(-1, ACCEPTED, 100))); } @@ -83,11 +83,11 @@ void wa_40() throws GradingException { testCaseResult(WRONG_ANSWER, "[11]", 0)), testGroupResult( -1, - testCaseResult(ACCEPTED, "20.0 [1]", -1), - testCaseResult(ACCEPTED, "20.0 [8]", -1), - testCaseResult(WRONG_ANSWER, "0.0 [11]", -1), - testCaseResult(WRONG_ANSWER, "0.0 [11]", -1), - testCaseResult(WRONG_ANSWER, "0.0 [11]", -1))), + testCaseResult(ACCEPTED, "20 [1]", -1), + testCaseResult(ACCEPTED, "20 [8]", -1), + testCaseResult(WRONG_ANSWER, "0 [11]", -1), + testCaseResult(WRONG_ANSWER, "0 [11]", -1), + testCaseResult(WRONG_ANSWER, "0 [11]", -1))), ImmutableList.of( subtaskResult(-1, WRONG_ANSWER, 40))); } @@ -108,11 +108,11 @@ void wa_90() throws GradingException { testCaseResult(ACCEPTED, "", 0)), testGroupResult( -1, - testCaseResult(OK, "10.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1))), + testCaseResult(OK, "10", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1))), ImmutableList.of( subtaskResult(-1, OK, 90))); } @@ -133,11 +133,11 @@ void tle_when_communication_timed_out() throws GradingException { testCaseResult(TIME_LIMIT_EXCEEDED, "", Optional.of(SandboxExecutionStatus.TIMED_OUT), 0)), testGroupResult( -1, - testCaseResult(TIME_LIMIT_EXCEEDED, "0.0", Optional.of(SandboxExecutionStatus.TIMED_OUT), -1), - testCaseResult(TIME_LIMIT_EXCEEDED, "0.0", Optional.of(SandboxExecutionStatus.TIMED_OUT), -1), - testCaseResult(TIME_LIMIT_EXCEEDED, "0.0", Optional.of(SandboxExecutionStatus.TIMED_OUT), -1), - testCaseResult(TIME_LIMIT_EXCEEDED, "0.0", Optional.of(SandboxExecutionStatus.TIMED_OUT), -1), - testCaseResult(TIME_LIMIT_EXCEEDED, "0.0", Optional.of(SandboxExecutionStatus.TIMED_OUT), -1))), + testCaseResult(TIME_LIMIT_EXCEEDED, "0", Optional.of(SandboxExecutionStatus.TIMED_OUT), -1), + testCaseResult(TIME_LIMIT_EXCEEDED, "0", Optional.of(SandboxExecutionStatus.TIMED_OUT), -1), + testCaseResult(TIME_LIMIT_EXCEEDED, "0", Optional.of(SandboxExecutionStatus.TIMED_OUT), -1), + testCaseResult(TIME_LIMIT_EXCEEDED, "0", Optional.of(SandboxExecutionStatus.TIMED_OUT), -1), + testCaseResult(TIME_LIMIT_EXCEEDED, "0", Optional.of(SandboxExecutionStatus.TIMED_OUT), -1))), List.of( subtaskResult(-1, TIME_LIMIT_EXCEEDED, 0))); } @@ -201,11 +201,11 @@ void when_communicator_received_sigpipe_before_verdict_then_we_should_return_wa( testCaseResult(WRONG_ANSWER, "", 0)), testGroupResult( -1, - testCaseResult(WRONG_ANSWER, "0.0", -1), - testCaseResult(WRONG_ANSWER, "0.0", -1), - testCaseResult(WRONG_ANSWER, "0.0", -1), - testCaseResult(WRONG_ANSWER, "0.0", -1), - testCaseResult(WRONG_ANSWER, "0.0", -1))), + testCaseResult(WRONG_ANSWER, "0", -1), + testCaseResult(WRONG_ANSWER, "0", -1), + testCaseResult(WRONG_ANSWER, "0", -1), + testCaseResult(WRONG_ANSWER, "0", -1), + testCaseResult(WRONG_ANSWER, "0", -1))), List.of( subtaskResult(-1, WRONG_ANSWER, 0))); } @@ -227,11 +227,11 @@ void when_communicator_received_sigpipe_after_verdict_then_we_should_still_retur testCaseResult(ACCEPTED, "", 0)), testGroupResult( -1, - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1), - testCaseResult(ACCEPTED, "20.0", -1))), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1), + testCaseResult(ACCEPTED, "20", -1))), List.of( subtaskResult(-1, ACCEPTED, 100))); } @@ -252,11 +252,11 @@ void when_solution_received_sigpipe_then_we_should_still_return_the_verdict() th testCaseResult(ACCEPTED, "[10]", 0)), testGroupResult( -1, - testCaseResult(ACCEPTED, "20.0 [9]", -1), - testCaseResult(ACCEPTED, "20.0 [10]", -1), - testCaseResult(ACCEPTED, "20.0 [10]", -1), - testCaseResult(ACCEPTED, "20.0 [9]", -1), - testCaseResult(ACCEPTED, "20.0 [1]", -1))), + testCaseResult(ACCEPTED, "20 [9]", -1), + testCaseResult(ACCEPTED, "20 [10]", -1), + testCaseResult(ACCEPTED, "20 [10]", -1), + testCaseResult(ACCEPTED, "20 [9]", -1), + testCaseResult(ACCEPTED, "20 [1]", -1))), List.of( subtaskResult(-1, ACCEPTED, 100))); } diff --git a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/interactive/InteractiveWithSubtasksGradingEngineIntegrationTests.java b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/interactive/InteractiveWithSubtasksGradingEngineIntegrationTests.java index 10962aa50..331afe6e6 100644 --- a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/interactive/InteractiveWithSubtasksGradingEngineIntegrationTests.java +++ b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/interactive/InteractiveWithSubtasksGradingEngineIntegrationTests.java @@ -50,18 +50,18 @@ void ac() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "* [8]", 0, 1, 2), - testCaseResult(ACCEPTED, "* [9]", 0, 1, 2), - testCaseResult(ACCEPTED, "* [10]", 0, 2)), + testCaseResult(ACCEPTED, "✓ [8]", 0, 1, 2), + testCaseResult(ACCEPTED, "✓ [9]", 0, 1, 2), + testCaseResult(ACCEPTED, "✓ [10]", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "* [9]", 1, 2), - testCaseResult(ACCEPTED, "* [10]", 1, 2)), + testCaseResult(ACCEPTED, "✓ [9]", 1, 2), + testCaseResult(ACCEPTED, "✓ [10]", 1, 2)), testGroupResult( 2, - testCaseResult(ACCEPTED, "* [10]", 2), - testCaseResult(ACCEPTED, "* [9]", 2), - testCaseResult(ACCEPTED, "* [1]", 2))), + testCaseResult(ACCEPTED, "✓ [10]", 2), + testCaseResult(ACCEPTED, "✓ [9]", 2), + testCaseResult(ACCEPTED, "✓ [1]", 2))), ImmutableList.of( subtaskResult(1, ACCEPTED, 30), subtaskResult(2, ACCEPTED, 70))); @@ -78,13 +78,13 @@ void wa_30() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "* [3]", 0, 1, 2), - testCaseResult(ACCEPTED, "* [5]", 0, 1, 2), - testCaseResult(WRONG_ANSWER, "X [11]", 0, 2)), + testCaseResult(ACCEPTED, "✓ [3]", 0, 1, 2), + testCaseResult(ACCEPTED, "✓ [5]", 0, 1, 2), + testCaseResult(WRONG_ANSWER, "✕ [11]", 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "* [1]", 1, 2), - testCaseResult(ACCEPTED, "* [8]", 1, 2)), + testCaseResult(ACCEPTED, "✓ [1]", 1, 2), + testCaseResult(ACCEPTED, "✓ [8]", 1, 2)), testGroupResult( 2, testCaseResult(SKIPPED, "?", Optional.empty(), 2), @@ -106,13 +106,13 @@ void rte_30() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "* [3]", 0, 1, 2), - testCaseResult(ACCEPTED, "* [5]", 0, 1, 2), - testCaseResult(RUNTIME_ERROR, "X", Optional.of(NONZERO_EXIT_CODE), 0, 2)), + testCaseResult(ACCEPTED, "✓ [3]", 0, 1, 2), + testCaseResult(ACCEPTED, "✓ [5]", 0, 1, 2), + testCaseResult(RUNTIME_ERROR, "✕", Optional.of(NONZERO_EXIT_CODE), 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "* [1]", 1, 2), - testCaseResult(ACCEPTED, "* [8]", 1, 2)), + testCaseResult(ACCEPTED, "✓ [1]", 1, 2), + testCaseResult(ACCEPTED, "✓ [8]", 1, 2)), testGroupResult( 2, testCaseResult(SKIPPED, "?", Optional.empty(), 2), diff --git a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/outputonly/OutputOnlyGradingEngineIntegrationTests.java b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/outputonly/OutputOnlyGradingEngineIntegrationTests.java index 7459d5adf..a88cb0856 100644 --- a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/outputonly/OutputOnlyGradingEngineIntegrationTests.java +++ b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/outputonly/OutputOnlyGradingEngineIntegrationTests.java @@ -50,11 +50,11 @@ void ac() throws GradingException { testCaseResult(ACCEPTED, "", Optional.empty(), 0)), testGroupResult( -1, - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1))), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1))), ImmutableList.of( subtaskResult(-1, ACCEPTED, 100))); } @@ -74,11 +74,11 @@ void ac_but_wa_at_sample_that_is_not_included() throws GradingException { testCaseResult(WRONG_ANSWER, "", Optional.empty(), 0)), testGroupResult( -1, - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1))), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1))), ImmutableList.of( subtaskResult(-1, ACCEPTED, 100))); } @@ -98,11 +98,11 @@ void wa_80() throws GradingException { testCaseResult(ACCEPTED, "", Optional.empty(), 0)), testGroupResult( -1, - testCaseResult(WRONG_ANSWER, "0.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1))), + testCaseResult(WRONG_ANSWER, "0", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1))), ImmutableList.of( subtaskResult(-1, WRONG_ANSWER, 80))); } @@ -122,11 +122,11 @@ void ok_80_because_some_output_files_missing() throws GradingException { testCaseResult(ACCEPTED, "", Optional.empty(), 0)), testGroupResult( -1, - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(SKIPPED, "0.0", Optional.empty(), -1))), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(SKIPPED, "0", Optional.empty(), -1))), ImmutableList.of( subtaskResult(-1, OK, 80))); } @@ -147,11 +147,11 @@ void ok_90_with_custom_scorer() throws GradingException { testCaseResult(ACCEPTED, "", Optional.empty(), 0)), testGroupResult( -1, - testCaseResult(OK, "10.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1), - testCaseResult(ACCEPTED, "20.0", Optional.empty(), -1))), + testCaseResult(OK, "10", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1), + testCaseResult(ACCEPTED, "20", Optional.empty(), -1))), ImmutableList.of( subtaskResult(-1, OK, 90))); } diff --git a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/outputonly/OutputOnlyWithSubtasksGradingEngineIntegrationTests.java b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/outputonly/OutputOnlyWithSubtasksGradingEngineIntegrationTests.java index 1b1b89ea8..fdfe7cc33 100644 --- a/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/outputonly/OutputOnlyWithSubtasksGradingEngineIntegrationTests.java +++ b/judgels-backends/judgels-grader-engines/src/integTest/java/judgels/gabriel/engines/outputonly/OutputOnlyWithSubtasksGradingEngineIntegrationTests.java @@ -47,18 +47,18 @@ void ac() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 2)), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", Optional.empty(), 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 1, 2)), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 1, 2)), testGroupResult( 2, - testCaseResult(ACCEPTED, "*", Optional.empty(), 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 2))), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 2))), ImmutableList.of( subtaskResult(1, ACCEPTED, 30), subtaskResult(2, ACCEPTED, 70))); @@ -74,18 +74,18 @@ void wa_30() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 2)), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", Optional.empty(), 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 1, 2)), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 1, 2)), testGroupResult( 2, - testCaseResult(ACCEPTED, "*", Optional.empty(), 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 2), - testCaseResult(WRONG_ANSWER, "X", Optional.empty(), 2))), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 2), + testCaseResult(WRONG_ANSWER, "✕", Optional.empty(), 2))), ImmutableList.of( subtaskResult(1, ACCEPTED, 30), subtaskResult(2, WRONG_ANSWER, 0))); @@ -101,13 +101,13 @@ void wa_30_at_sample() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 1, 2), - testCaseResult(WRONG_ANSWER, "X", Optional.empty(), 0, 2)), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 1, 2), + testCaseResult(WRONG_ANSWER, "✕", Optional.empty(), 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", Optional.empty(), 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 1, 2)), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 1, 2)), testGroupResult( 2, testCaseResult(SKIPPED, "?", Optional.empty(), 2), @@ -128,17 +128,17 @@ void wa_30_because_some_files_missing() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 2)), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", Optional.empty(), 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 1, 2)), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 1, 2)), testGroupResult( 2, - testCaseResult(ACCEPTED, "*", Optional.empty(), 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 2), testCaseResult(SKIPPED, "?", Optional.empty(), 2))), ImmutableList.of( subtaskResult(1, ACCEPTED, 30), @@ -155,12 +155,12 @@ void wa_0() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 2)), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 2)), testGroupResult( 1, - testCaseResult(WRONG_ANSWER, "X", Optional.empty(), 1, 2), + testCaseResult(WRONG_ANSWER, "✕", Optional.empty(), 1, 2), testCaseResult(SKIPPED, "?", Optional.empty(), 1, 2)), testGroupResult( 2, @@ -183,18 +183,18 @@ void ac_with_custom_scorer() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 2)), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", Optional.empty(), 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 1, 2)), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 1, 2)), testGroupResult( 2, - testCaseResult(ACCEPTED, "*", Optional.empty(), 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 2))), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 2))), ImmutableList.of( subtaskResult(1, ACCEPTED, 30), subtaskResult(2, ACCEPTED, 70))); @@ -211,18 +211,18 @@ void wa_30_with_custom_scorer() throws GradingException { ImmutableList.of( testGroupResult( 0, - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 0, 2)), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 0, 2)), testGroupResult( 1, - testCaseResult(ACCEPTED, "*", Optional.empty(), 1, 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 1, 2)), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 1, 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 1, 2)), testGroupResult( 2, - testCaseResult(ACCEPTED, "*", Optional.empty(), 2), - testCaseResult(ACCEPTED, "*", Optional.empty(), 2), - testCaseResult(WRONG_ANSWER, "X", Optional.empty(), 2))), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 2), + testCaseResult(ACCEPTED, "✓", Optional.empty(), 2), + testCaseResult(WRONG_ANSWER, "✕", Optional.empty(), 2))), ImmutableList.of( subtaskResult(1, ACCEPTED, 30), subtaskResult(2, WRONG_ANSWER, 0))); diff --git a/judgels-backends/judgels-grader-engines/src/main/java/judgels/gabriel/aggregators/MinAggregator.java b/judgels-backends/judgels-grader-engines/src/main/java/judgels/gabriel/aggregators/MinAggregator.java index 7a1e65ba7..685135f03 100644 --- a/judgels-backends/judgels-grader-engines/src/main/java/judgels/gabriel/aggregators/MinAggregator.java +++ b/judgels-backends/judgels-grader-engines/src/main/java/judgels/gabriel/aggregators/MinAggregator.java @@ -26,20 +26,20 @@ public AggregationResult aggregate(List testCaseVerdicts, doubl double okPoints = 0.0; if (testCaseVerdict.getPercentage().isPresent()) { okPoints = testCaseVerdict.getPercentage().get() * subtaskPoints / 100.0; - points = testCaseVerdict.getPercentage().get() + "%"; + points = PointUtils.formatPoints(testCaseVerdict.getPercentage().get()) + "%"; } else if (testCaseVerdict.getPoints().isPresent()) { okPoints = testCaseVerdict.getPoints().get(); - points = "" + okPoints; + points = PointUtils.formatPoints(okPoints); } aggregatedPoints = Math.min(aggregatedPoints, okPoints); } else if (verdict == Verdict.ACCEPTED) { - points = "*"; + points = "✓"; } else if (verdict == Verdict.SKIPPED) { aggregatedPoints = 0.0; points = "?"; } else { aggregatedPoints = 0.0; - points = "X"; + points = "✕"; } testCasePoints.add(points); diff --git a/judgels-backends/judgels-grader-engines/src/main/java/judgels/gabriel/aggregators/PointUtils.java b/judgels-backends/judgels-grader-engines/src/main/java/judgels/gabriel/aggregators/PointUtils.java new file mode 100644 index 000000000..37aa8a061 --- /dev/null +++ b/judgels-backends/judgels-grader-engines/src/main/java/judgels/gabriel/aggregators/PointUtils.java @@ -0,0 +1,18 @@ +package judgels.gabriel.aggregators; + +public class PointUtils { + private PointUtils() {} + + public static String formatPoints(double pts) { + String result = "" + pts; + if (result.contains(".")) { + while (result.charAt(result.length() - 1) == '0') { + result = result.substring(0, result.length() - 1); + } + if (result.charAt(result.length() - 1) == '.') { + result = result.substring(0, result.length() - 1); + } + } + return result; + } +} diff --git a/judgels-backends/judgels-grader-engines/src/main/java/judgels/gabriel/aggregators/SumAggregator.java b/judgels-backends/judgels-grader-engines/src/main/java/judgels/gabriel/aggregators/SumAggregator.java index 6b4aadd73..5163a4723 100644 --- a/judgels-backends/judgels-grader-engines/src/main/java/judgels/gabriel/aggregators/SumAggregator.java +++ b/judgels-backends/judgels-grader-engines/src/main/java/judgels/gabriel/aggregators/SumAggregator.java @@ -37,7 +37,7 @@ public AggregationResult aggregate(List testCaseVerdicts, doubl } aggregatedPoints += points; - testCasePoints.add("" + points); + testCasePoints.add(PointUtils.formatPoints(points)); } if (aggregatedVerdict == Verdict.SKIPPED) { aggregatedVerdict = Verdict.OK; diff --git a/judgels-backends/judgels-grader-engines/src/test/java/judgels/gabriel/aggregators/MinAggregatorTests.java b/judgels-backends/judgels-grader-engines/src/test/java/judgels/gabriel/aggregators/MinAggregatorTests.java index 592a9d7d7..d3eb4a357 100644 --- a/judgels-backends/judgels-grader-engines/src/test/java/judgels/gabriel/aggregators/MinAggregatorTests.java +++ b/judgels-backends/judgels-grader-engines/src/test/java/judgels/gabriel/aggregators/MinAggregatorTests.java @@ -27,7 +27,7 @@ void aggregate_full_points() { AggregationResult result = aggregator.aggregate(testCaseVerdicts, 70.0); assertThat(result.getSubtaskVerdict()).isEqualTo(SubtaskVerdict.of(Verdict.ACCEPTED, 70.0)); - assertThat(result.getTestCasePoints()).containsExactly("*", "*"); + assertThat(result.getTestCasePoints()).containsExactly("✓", "✓"); } @Test @@ -39,7 +39,7 @@ void aggregate_zero_points() { AggregationResult result = aggregator.aggregate(testCaseVerdicts, 70.0); assertThat(result.getSubtaskVerdict()).isEqualTo(SubtaskVerdict.of(Verdict.RUNTIME_ERROR, 0.0)); - assertThat(result.getTestCasePoints()).containsExactly("*", "X", "X"); + assertThat(result.getTestCasePoints()).containsExactly("✓", "✕", "✕"); } @Test @@ -51,7 +51,7 @@ void aggregate_zero_points_with_skipped() { AggregationResult result = aggregator.aggregate(testCaseVerdicts, 70.0); assertThat(result.getSubtaskVerdict()).isEqualTo(SubtaskVerdict.of(Verdict.RUNTIME_ERROR, 0.0)); - assertThat(result.getTestCasePoints()).containsExactly("*", "X", "?"); + assertThat(result.getTestCasePoints()).containsExactly("✓", "✕", "?"); } @Test @@ -63,19 +63,19 @@ void aggregate_zero_points_with_accepted_and_skipped() { AggregationResult result = aggregator.aggregate(testCaseVerdicts, 70.0); assertThat(result.getSubtaskVerdict()).isEqualTo(SubtaskVerdict.of(Verdict.OK, 0.0)); - assertThat(result.getTestCasePoints()).containsExactly("*", "*", "?"); + assertThat(result.getTestCasePoints()).containsExactly("✓", "✓", "?"); } @Test void aggregate_min_ok_points() { List testCaseVerdicts = ImmutableList.of( new TestCaseVerdict.Builder().verdict(Verdict.ACCEPTED).build(), - new TestCaseVerdict.Builder().verdict(Verdict.OK).points(20.0).build(), + new TestCaseVerdict.Builder().verdict(Verdict.OK).points(20.5).build(), new TestCaseVerdict.Builder().verdict(Verdict.OK).points(30.0).build()); AggregationResult result = aggregator.aggregate(testCaseVerdicts, 70.0); - assertThat(result.getSubtaskVerdict()).isEqualTo(SubtaskVerdict.of(Verdict.OK, 20.0)); - assertThat(result.getTestCasePoints()).containsExactly("*", "20.0", "30.0"); + assertThat(result.getSubtaskVerdict()).isEqualTo(SubtaskVerdict.of(Verdict.OK, 20.5)); + assertThat(result.getTestCasePoints()).containsExactly("✓", "20.5", "30"); } @Test @@ -87,7 +87,7 @@ void aggregate_min_ok_percentage() { AggregationResult result = aggregator.aggregate(testCaseVerdicts, 70.0); assertThat(result.getSubtaskVerdict()).isEqualTo(SubtaskVerdict.of(Verdict.OK, 8.75)); - assertThat(result.getTestCasePoints()).containsExactly("*", "12.5%", "50.0%"); + assertThat(result.getTestCasePoints()).containsExactly("✓", "12.5%", "50%"); } @Test diff --git a/judgels-backends/judgels-grader-engines/src/test/java/judgels/gabriel/aggregators/SumAggregatorTests.java b/judgels-backends/judgels-grader-engines/src/test/java/judgels/gabriel/aggregators/SumAggregatorTests.java index 44cdc9881..0b3c92a22 100644 --- a/judgels-backends/judgels-grader-engines/src/test/java/judgels/gabriel/aggregators/SumAggregatorTests.java +++ b/judgels-backends/judgels-grader-engines/src/test/java/judgels/gabriel/aggregators/SumAggregatorTests.java @@ -27,7 +27,7 @@ void aggregate_full_points() { AggregationResult result = aggregator.aggregate(testCaseVerdicts, 100.0); assertThat(result.getSubtaskVerdict()).isEqualTo(SubtaskVerdict.of(Verdict.ACCEPTED, 100.0)); - assertThat(result.getTestCasePoints()).containsExactly("50.0", "50.0"); + assertThat(result.getTestCasePoints()).containsExactly("50", "50"); } @Test @@ -40,7 +40,7 @@ void aggregate_partial_points() { AggregationResult result = aggregator.aggregate(testCaseVerdicts, 100.0); assertThat(result.getSubtaskVerdict()).isEqualTo(SubtaskVerdict.of(Verdict.TIME_LIMIT_EXCEEDED, 55.0)); - assertThat(result.getTestCasePoints()).containsExactly("25.0", "0.0", "30.0", "0.0"); + assertThat(result.getTestCasePoints()).containsExactly("25", "0", "30", "0"); } @Test @@ -53,7 +53,7 @@ void aggregate_partial_points_with_skipped() { AggregationResult result = aggregator.aggregate(testCaseVerdicts, 100.0); assertThat(result.getSubtaskVerdict()).isEqualTo(SubtaskVerdict.of(Verdict.TIME_LIMIT_EXCEEDED, 50.0)); - assertThat(result.getTestCasePoints()).containsExactly("25.0", "25.0", "0.0", "0.0"); + assertThat(result.getTestCasePoints()).containsExactly("25", "25", "0", "0"); } @Test @@ -66,7 +66,7 @@ void aggregate_partial_points_with_accepted_and_skipped() { AggregationResult result = aggregator.aggregate(testCaseVerdicts, 100.0); assertThat(result.getSubtaskVerdict()).isEqualTo(SubtaskVerdict.of(Verdict.OK, 50.0)); - assertThat(result.getTestCasePoints()).containsExactly("25.0", "25.0", "0.0", "0.0"); + assertThat(result.getTestCasePoints()).containsExactly("25", "25", "0", "0"); } @Test