Skip to content

Commit

Permalink
Add testlib interactor checker
Browse files Browse the repository at this point in the history
  • Loading branch information
cuom1999 committed Nov 20, 2024
1 parent ffab598 commit 6cfeaa7
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 4 deletions.
61 changes: 61 additions & 0 deletions judge/migrations/0196_add_interactive_testlib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Generated by Django 3.2.25 on 2024-11-20 22:42

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("judge", "0195_signature_grader"),
]

operations = [
migrations.AlterField(
model_name="problemdata",
name="checker",
field=models.CharField(
blank=True,
choices=[
("standard", "Standard"),
("floats", "Floats"),
("floatsabs", "Floats (absolute)"),
("floatsrel", "Floats (relative)"),
("rstripped", "Non-trailing spaces"),
("sorted", "Unordered"),
("identical", "Byte identical"),
("linecount", "Line-by-line"),
("custom", "Custom checker (PY)"),
("customcpp", "Custom checker (CPP)"),
("interact", "Interactive"),
("testlib", "Testlib"),
("interacttl", "Interactive (Testlib)"),
],
max_length=10,
verbose_name="checker",
),
),
migrations.AlterField(
model_name="problemtestcase",
name="checker",
field=models.CharField(
blank=True,
choices=[
("standard", "Standard"),
("floats", "Floats"),
("floatsabs", "Floats (absolute)"),
("floatsrel", "Floats (relative)"),
("rstripped", "Non-trailing spaces"),
("sorted", "Unordered"),
("identical", "Byte identical"),
("linecount", "Line-by-line"),
("custom", "Custom checker (PY)"),
("customcpp", "Custom checker (CPP)"),
("interact", "Interactive"),
("testlib", "Testlib"),
("interacttl", "Interactive (Testlib)"),
],
max_length=10,
verbose_name="checker",
),
),
]
1 change: 1 addition & 0 deletions judge/models/problem_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def problem_directory_file(data, filename):
("customcpp", _("Custom checker (CPP)")),
("interact", _("Interactive")),
("testlib", _("Testlib")),
("interacttl", _("Interactive (Testlib)")),
)


Expand Down
4 changes: 2 additions & 2 deletions judge/utils/problem_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,14 @@ def make_checker(case):
if self.data.output_prefix is not None:
init["output_prefix_length"] = self.data.output_prefix
if self.data.checker:
if self.data.checker == "interact":
if self.data.checker in ("interact", "interacttl"):
interactor_path = split_path_first(self.data.interactive_judge.name)
if len(interactor_path) != 2:
raise ProblemDataError(_("Invalid interactor judge"))
init["interactive"] = {
"files": interactor_path[1],
"feedback": True,
"type": "lqdoj",
"type": "lqdoj" if self.data.checker == "interact" else "testlib",
}
init["unbuffered"] = True
else:
Expand Down
4 changes: 2 additions & 2 deletions templates/problem/data.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@
$checker.change(function () {
$tr_checker.toggle($checker.val() == 'custom').change();
$tr_validator.toggle($checker.val() == 'customcpp' || $checker.val() == 'testlib').change();
$tr_interactive.toggle($checker.val() == 'interact').change();
$tr_interactive.toggle($checker.val() == 'interact' || $checker.val() == 'interacttl').change();

$sample.toggle(['custom', 'customcpp', 'interact'].includes($checker.val())).change();
$sample.toggle(['custom', 'customcpp', 'interact', 'interacttl'].includes($checker.val())).change();
}).change();

$ioi_signature.change(function() {
Expand Down

0 comments on commit 6cfeaa7

Please sign in to comment.