def _ipc_result(self, report, batch_number: Optional[int], case_number: int, result: Result) -> None: codes = result.readable_codes() is_sc = result.result_flag & Result.SC colored_codes = [ '#ansi[%s](%s|bold)' % ('--' if x == 'SC' else x, Result.COLORS_BYID[x]) for x in codes ] colored_aux_codes = '{%s}' % ', '.join( colored_codes[1:]) if len(codes) > 1 else '' colored_feedback = '(#ansi[%s](|underline)) ' % utf8text( result.feedback) if result.feedback else '' if is_sc: case_info = '' else: case_info = '[%.3fs (%.3fs) | %dkb] %s%s' % ( result.execution_time, result.wall_clock_time, result.max_memory, colored_feedback, colored_aux_codes, ) case_padding = ' ' if batch_number is not None else '' report( ansi_style( '%sTest case %2d %-3s %s' % (case_padding, case_number, colored_codes[0], case_info))) self.packet_manager.test_case_status_packet(case_number, result)
def test_case_status_packet(self, position: int, result: Result): log.info('Test case on %d: #%d, %s [%.3fs | %.2f MB], %.1f/%.0f', self.judge.current_submission_id, position, ', '.join(result.readable_codes()), result.execution_time, result.max_memory / 1024.0, result.points, result.total_points) with self._testcase_queue_lock: self._testcase_queue.append((position, result))