checkers
This commit is contained in:
parent
c82fc75f70
commit
158a007b37
@ -31,10 +31,11 @@ class BaseTester:
|
|||||||
raise TestException("CE")
|
raise TestException("CE")
|
||||||
|
|
||||||
def test(self, filename):
|
def test(self, filename):
|
||||||
code = self.solution.exec_command(
|
with Timer(self.solution, filename):
|
||||||
f"< {filename} {self.command} > output.txt",
|
code = self.solution.exec_command(
|
||||||
timeout=self.solution.task.time_limit / 1000,
|
f"< {filename} {self.command} > output.txt",
|
||||||
)
|
timeout=self.solution.task.time_limit / 1000,
|
||||||
|
)
|
||||||
if code != 0:
|
if code != 0:
|
||||||
raise TestException("RE")
|
raise TestException("RE")
|
||||||
result = open(join(self.solution.testing_directory, "output.txt"), "r").read().strip().replace('\r\n', '\n')
|
result = open(join(self.solution.testing_directory, "output.txt"), "r").read().strip().replace('\r\n', '\n')
|
||||||
@ -123,8 +124,7 @@ class BaseTester:
|
|||||||
self.solution.extras[test.filename] = {'predicted': test.text, 'output': ''}
|
self.solution.extras[test.filename] = {'predicted': test.text, 'output': ''}
|
||||||
self.solution.save()
|
self.solution.save()
|
||||||
try:
|
try:
|
||||||
with Timer(self.solution, test.filename) as timer:
|
self.test(test.filename)
|
||||||
self.test(test.filename)
|
|
||||||
finally:
|
finally:
|
||||||
if exists(join(self.path, "output.txt")):
|
if exists(join(self.path, "output.txt")):
|
||||||
try:
|
try:
|
||||||
|
@ -45,4 +45,22 @@
|
|||||||
<pre><code class="{{ entity.highlight }}" style="border: 1px solid black;">{{ entity.text }}</code></pre>
|
<pre><code class="{{ entity.highlight }}" style="border: 1px solid black;">{{ entity.text }}</code></pre>
|
||||||
<hr>
|
<hr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if solution.task.creator == user or user.username in solution.task.editors or solution.set and solution.set.creator == user or solution.set and user.username in solution.set.editors %}
|
||||||
|
<h4>Лог тестрования</h4>
|
||||||
|
{% for key, value in solution.extras.items %}
|
||||||
|
<h5>{{ key }}</h5>
|
||||||
|
Затраченное время: {{ value.time_spent }} мс
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-2"></div>
|
||||||
|
<div class="col-2" style="background-color: #DDDDDD;">
|
||||||
|
{{ value.predicted }}
|
||||||
|
</div>
|
||||||
|
<div class="col-4"></div>
|
||||||
|
<div class="col-2" style="background-color: #DDDDDD;">
|
||||||
|
{{ value.output }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user