From 49c9673beca13ba57142a71ba85634e76df3b220 Mon Sep 17 00:00:00 2001 From: Niko Strijbol Date: Sun, 29 Mar 2020 23:47:03 +0200 Subject: [PATCH] Add time and memory limit status to partial format --- public/schemas/partial_output.json | 2 ++ test/runners/result_constructor_test.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/public/schemas/partial_output.json b/public/schemas/partial_output.json index 8daedf4231..58f496146b 100644 --- a/public/schemas/partial_output.json +++ b/public/schemas/partial_output.json @@ -197,6 +197,8 @@ "enum": [ "internal error", "compilation error", + "memory limit exceeded", + "time limit exceeded", "runtime error", "wrong", "wrong answer", "correct", "correct answer" diff --git a/test/runners/result_constructor_test.rb b/test/runners/result_constructor_test.rb index 11388ac27d..b72b62039a 100644 --- a/test/runners/result_constructor_test.rb +++ b/test/runners/result_constructor_test.rb @@ -269,6 +269,18 @@ class ResultConstructorTest < ActiveSupport::TestCase '{ "command": "close-judgement", "status": { "enum": "runtime error", "human": "Runtime" } }' ]) assert_equal('runtime error', result[:status]) + result = construct_result([ + '{ "command": "start-judgement" }', + '{ "command": "escalate-status", "status": { "enum": "wrong", "human": "Wrong" } }', + '{ "command": "close-judgement", "status": { "enum": "memory limit exceeded", "human": "Runtime" } }' + ]) + assert_equal('memory limit exceeded', result[:status]) + result = construct_result([ + '{ "command": "start-judgement" }', + '{ "command": "escalate-status", "status": { "enum": "wrong", "human": "Wrong" } }', + '{ "command": "close-judgement", "status": { "enum": "time limit exceeded", "human": "Runtime" } }' + ]) + assert_equal('time limit exceeded', result[:status]) end test 'correct permissions should be present in result' do