Skip to content

Commit

Permalink
changed some names
Browse files Browse the repository at this point in the history
  • Loading branch information
BrentBlanckaert committed Jan 11, 2025
1 parent 32f961a commit 99a26c5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 37 deletions.
32 changes: 18 additions & 14 deletions tested/dsl/schema-strict.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}
],
"properties" : {
"files" : {
"in_files" : {
"description" : "A list of files used in the test suite.",
"type" : "array",
"items" : {
Expand Down Expand Up @@ -97,7 +97,7 @@
"tab"
],
"properties" : {
"files" : {
"in_files" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/file"
Expand Down Expand Up @@ -149,7 +149,7 @@
"unit"
],
"properties" : {
"files" : {
"in_files" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/file"
Expand Down Expand Up @@ -229,7 +229,7 @@
"testcases"
],
"properties" : {
"files" : {
"in_files" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/file"
Expand All @@ -251,7 +251,7 @@
"script"
],
"properties" : {
"files" : {
"in_files" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/file"
Expand Down Expand Up @@ -335,7 +335,7 @@
}
]
},
"files" : {
"in_files" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/file"
Expand All @@ -353,7 +353,7 @@
"description" : "Expected output at stdout",
"$ref" : "#/definitions/textOutputChannel"
},
"file": {
"out_files": {
"description" : "Expected files generated by the submission.",
"$ref" : "#/definitions/fileOutputChannel"
},
Expand Down Expand Up @@ -431,7 +431,7 @@
}
]
},
"files" : {
"in_files" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/file"
Expand All @@ -449,6 +449,10 @@
"description" : "Expected output at stdout",
"$ref" : "#/definitions/textOutputChannel"
},
"out_files": {
"description" : "Expected files generated by the submission.",
"$ref" : "#/definitions/fileOutputChannel"
},
"exit_code" : {
"type" : "integer",
"description" : "Expected exit code for the run"
Expand Down Expand Up @@ -493,14 +497,14 @@
"description" : "A file used in the test suite.",
"required" : [
"name",
"url"
"path"
],
"properties" : {
"name" : {
"type" : "string",
"description" : "The filename, including the file extension."
},
"url" : {
"path" : {
"type" : "string",
"format" : "uri",
"description" : "Relative path to the file in the `description` folder of an exercise."
Expand Down Expand Up @@ -578,15 +582,15 @@
"type" : "object",
"description" : "Built-in oracle for files.",
"required" : [
"content",
"location"
"path_expected",
"path_generated"
],
"properties" : {
"content" : {
"path_expected" : {
"type" : "string",
"description" : "Path to the file containing the expected contents, relative to the evaluation directory."
},
"location" : {
"path_generated" : {
"type" : "string",
"description" : "Path to where the file generated by the submission should go."
},
Expand Down
32 changes: 18 additions & 14 deletions tested/dsl/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}
],
"properties" : {
"files" : {
"in_files" : {
"description" : "A list of files used in the test suite.",
"type" : "array",
"items" : {
Expand Down Expand Up @@ -97,7 +97,7 @@
"tab"
],
"properties" : {
"files" : {
"in_files" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/file"
Expand Down Expand Up @@ -149,7 +149,7 @@
"unit"
],
"properties" : {
"files" : {
"in_files" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/file"
Expand Down Expand Up @@ -229,7 +229,7 @@
"testcases"
],
"properties" : {
"files" : {
"in_files" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/file"
Expand All @@ -251,7 +251,7 @@
"script"
],
"properties" : {
"files" : {
"in_files" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/file"
Expand Down Expand Up @@ -335,7 +335,7 @@
}
]
},
"files" : {
"in_files" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/file"
Expand All @@ -353,6 +353,10 @@
"description" : "Expected output at stdout",
"$ref" : "#/definitions/textOutputChannel"
},
"out_files": {
"description" : "Expected files generated by the submission.",
"$ref" : "#/definitions/fileOutputChannel"
},
"exit_code" : {
"type" : "integer",
"description" : "Expected exit code for the run"
Expand Down Expand Up @@ -427,7 +431,7 @@
}
]
},
"files" : {
"in_files" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/file"
Expand All @@ -445,7 +449,7 @@
"description" : "Expected output at stdout",
"$ref" : "#/definitions/textOutputChannel"
},
"file": {
"out_files": {
"description" : "Expected files generated by the submission.",
"$ref" : "#/definitions/fileOutputChannel"
},
Expand Down Expand Up @@ -493,14 +497,14 @@
"description" : "A file used in the test suite.",
"required" : [
"name",
"url"
"path"
],
"properties" : {
"name" : {
"type" : "string",
"description" : "The filename, including the file extension."
},
"url" : {
"path" : {
"type" : "string",
"format" : "uri",
"description" : "Relative path to the file in the `description` folder of an exercise."
Expand Down Expand Up @@ -578,15 +582,15 @@
"type" : "object",
"description" : "Built-in oracle for files.",
"required" : [
"content",
"location"
"path_expected",
"path_generated"
],
"properties" : {
"content" : {
"path_expected" : {
"type" : "string",
"description" : "Path to the file containing the expected contents, relative to the evaluation directory."
},
"location" : {
"path_generated" : {
"type" : "string",
"description" : "Path to where the file generated by the submission should go."
},
Expand Down
18 changes: 9 additions & 9 deletions tested/dsl/translate_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ def deepen_context(self, new_level: YamlDict | None) -> "DslContext":
return self

the_files = self.files
if "files" in new_level:
assert isinstance(new_level["files"], list)
additional_files = {_convert_file(f) for f in new_level["files"]}
if "in_files" in new_level:
assert isinstance(new_level["in_files"], list)
additional_files = {_convert_file(f) for f in new_level["in_files"]}
the_files = list(set(self.files) | additional_files)

the_config = self.config
Expand Down Expand Up @@ -395,8 +395,8 @@ def _convert_value(value: YamlObject) -> Value:

def _convert_file(link_file: YamlDict) -> FileUrl:
assert isinstance(link_file["name"], str)
assert isinstance(link_file["url"], str)
return FileUrl(name=link_file["name"], url=link_file["url"])
assert isinstance(link_file["path"], str)
return FileUrl(name=link_file["name"], url=link_file["path"])


def _convert_evaluation_function(stream: dict) -> EvaluationFunction:
Expand Down Expand Up @@ -479,8 +479,8 @@ def _convert_file_output_channel(
) -> FileOutputChannel:
assert isinstance(stream, dict)

expected = str(stream["content"])
actual = str(stream["location"])
expected = str(stream["path_expected"])
actual = str(stream["path_generated"])

if "oracle" not in stream or stream["oracle"] == "builtin":
config = context.merge_inheritable_with_specific_config(stream, config_name)
Expand Down Expand Up @@ -606,8 +606,8 @@ def _convert_testcase(testcase: YamlDict, context: DslContext) -> Testcase:

if (stdout := testcase.get("stdout")) is not None:
output.stdout = _convert_text_output_channel(stdout, context, "stdout")
if (file := testcase.get("file")) is not None:
output.file = _convert_file_output_channel(file, context, "file")
if (file := testcase.get("out_files")) is not None:
output.file = _convert_file_output_channel(file, context, "out_files")
if (stderr := testcase.get("stderr")) is not None:
output.stderr = _convert_text_output_channel(stderr, context, "stderr")
if (exception := testcase.get("exception")) is not None:
Expand Down

0 comments on commit 99a26c5

Please sign in to comment.