From f739810270184fa49bbfaf2b51cbfc440a722b4a Mon Sep 17 00:00:00 2001 From: Thore Husfeldt Date: Thu, 12 Dec 2024 20:13:35 +0100 Subject: [PATCH] submissions schema learns globbing --- support/schemas/submissions.cue | 12 ++++- .../valid_yaml/valid.submissions.yaml | 50 +++++++++++++++++++ 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 test/yaml/submissions/valid_yaml/valid.submissions.yaml diff --git a/support/schemas/submissions.cue b/support/schemas/submissions.cue index d426b2b0..0aba51a3 100644 --- a/support/schemas/submissions.cue +++ b/support/schemas/submissions.cue @@ -6,13 +6,21 @@ import "list" #verdict: "AC" | "WA" | "RTE" | "TLE" -#testnode_pattern: =~"[a-zA-Z0-9_/\\*]+" // TODO +let globbed_dirname = "[A-Za-z0-9*]([A-Za-z0-9_*-]{0,253}[A-Za-z0-9*])?" +#globbed_dirpath: =~"^(\(globbed_dirname)/)*\(globbed_dirname)$" & !~ "\\*\\*" +let globbed_filename = "([A-Za-z0-9*][A-Za-z0-9_.*-]{0,253}[A-Za-z0-9*]|\\*)" + +#globbed_submissionpath: =~"^(\(globbed_dirname)/)*\(globbed_filename)$" & !~ "\\*\\*" #Submissions: { + [#globbed_submissionpath]: #submission +} + +#submission: { language?: string entrypoint?: string author?: #person | [...#person] #expectation - [=~"^(sample|secret|\\*)" & #testnode_pattern]: #expectation + [=~"^(sample|secret|\\*)" & #globbed_dirpath]: #expectation } #expectation: { diff --git a/test/yaml/submissions/valid_yaml/valid.submissions.yaml b/test/yaml/submissions/valid_yaml/valid.submissions.yaml new file mode 100644 index 00000000..1f2eeca3 --- /dev/null +++ b/test/yaml/submissions/valid_yaml/valid.submissions.yaml @@ -0,0 +1,50 @@ +accepted/th.py: + permitted: ["AC"] +--- +# applies to all submissions in accepted/ +accepted: + permitted: ["AC"] +--- +# this submissions passes all samples +accepted/a.py: + sample: + permitted: ["AC"] +--- +# use globs for testnodes +accepted/a.py: + sample: + required: ["AC"] + secret/*/huge: + required: ["TLE"] +--- +# specify many things for a submission +accepted/lovelace.ada: + author: Ada Lovelace + score: [0, 20] + sample: + required: ["AC"] + secret/*/huge: + required: ["TLE"] +--- +# More than one submission: +accepted/a.py: + score: [60, 80] +accepted/b.py: + score: [70, 74] +--- +other/*.py: + required: ["TLE"] +--- +other/*: + required: ["TLE"] +--- +accepted: + author: "Ragnar van’t Höfnarß " + permitted: ["AC", "TLE", "WA"] + required: ["TLE"] + score: [40, 50] + sample: { required: [WA] } + sample/1 : { required: [AC] } + secret/*/huge: { required: [TLE] } # can use globbing + "*/sample/foo": { permitted: [AC, TLE] } # remember quotes bc * is weird in YAML + secret/*/*/1: { required: [TLE] } # no ** \ No newline at end of file