diff --git a/judge/migrations/0129_auto_20220622_1424.py b/judge/migrations/0129_auto_20220622_1424.py new file mode 100644 index 0000000..601bb85 --- /dev/null +++ b/judge/migrations/0129_auto_20220622_1424.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2.25 on 2022-06-22 07:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('judge', '0128_auto_20220620_2210'), + ] + + 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)'), ('customval', 'Custom validator (CPP)'), ('interact', 'Interactive'), ('testlib', '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)'), ('customval', 'Custom validator (CPP)'), ('interact', 'Interactive'), ('testlib', 'Testlib')], max_length=10, verbose_name='checker'), + ), + ] diff --git a/judge/models/problem_data.py b/judge/models/problem_data.py index f219197..c47559a 100644 --- a/judge/models/problem_data.py +++ b/judge/models/problem_data.py @@ -40,6 +40,7 @@ CHECKERS = ( ("custom", _("Custom checker (PY)")), ("customval", _("Custom validator (CPP)")), ("interact", _("Interactive")), + ("testlib", _("Testlib")), ) diff --git a/judge/utils/problem_data.py b/judge/utils/problem_data.py index b827d71..95b5a12 100644 --- a/judge/utils/problem_data.py +++ b/judge/utils/problem_data.py @@ -96,6 +96,21 @@ class ProblemDataCompiler(object): }, } + if case.checker == "testlib": + custom_checker_path = split_path_first(case.custom_validator.name) + if len(custom_checker_path) != 2: + raise ProblemDataError( + _("How did you corrupt the custom checker path?") + ) + return { + "name": "bridged", + "args": { + "files": custom_checker_path[1], + "lang": "CPP14", + "type": "testlib", + }, + } + if case.checker_args: return { "name": case.checker, @@ -215,8 +230,11 @@ class ProblemDataCompiler(object): init["output_prefix_length"] = self.data.output_prefix if self.data.checker: if self.data.checker == "interact": + interactor_path = split_path_first(self.data.interactive_judge.name) + if len(interactor_path) != 2: + raise ProblemDataError(_("How did you corrupt the interactor path?")) init["interactive"] = { - "files": split_path_first(self.data.interactive_judge.name)[1], + "files": interactor_path[1], "feedback": True, "type": "lqdoj", } diff --git a/templates/problem/data.html b/templates/problem/data.html index 1b77d85..0274d75 100644 --- a/templates/problem/data.html +++ b/templates/problem/data.html @@ -46,7 +46,6 @@ update_select2(); function autofill_if_exists($select, file) { - console.log(1); if (!$select.val() && ~window.valid_files.indexOf(file)) $select.val(file).trigger('change'); } @@ -154,7 +153,7 @@ $checker.change(function () { $tr_checker.toggle($checker.val() == 'custom').change(); - $tr_validator.toggle($checker.val() == 'customval').change(); + $tr_validator.toggle($checker.val() == 'customval' || $checker.val() == 'testlib').change(); $tr_interactive.toggle($checker.val() == 'interact').change(); $sample.toggle(['custom', 'customval', 'interact'].includes($checker.val())).change();