Add testlib
This commit is contained in:
parent
2eaf71c535
commit
7c171d59c1
4 changed files with 44 additions and 3 deletions
23
judge/migrations/0129_auto_20220622_1424.py
Normal file
23
judge/migrations/0129_auto_20220622_1424.py
Normal file
|
@ -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'),
|
||||
),
|
||||
]
|
|
@ -40,6 +40,7 @@ CHECKERS = (
|
|||
("custom", _("Custom checker (PY)")),
|
||||
("customval", _("Custom validator (CPP)")),
|
||||
("interact", _("Interactive")),
|
||||
("testlib", _("Testlib")),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -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",
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue