Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions bin/verify-exercises.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ extends SceneTree

# godot --headless -s bin/verify-exercises.gd


func _init():
# Calling `quit(1)` doesn't stop the program immediately, so a `return` is necessary.
# That's why errors are checked directly in `_init()`, instead of calling `quit(1)`
Expand All @@ -13,15 +14,13 @@ func _init():
return
var temp_dir_base_path = temp_dir_base.get_current_dir()

for exercise_base in [
"exercises/practice",
"exercises/concept"
]:
for exercise_base in ["exercises/practice", "exercises/concept"]:
if run_tests(exercise_base, temp_dir_base_path) != OK:
quit(1)
return
quit()


func run_tests(exercise_base: String, temp_dir_base_path: String) -> Error:
for slug in DirAccess.get_directories_at(exercise_base):
var result = run_test(slug, exercise_base + "/" + slug, temp_dir_base_path)
Expand Down Expand Up @@ -49,7 +48,14 @@ func run_test(slug: String, exercise_dir: String, temp_dir_base_path: String) ->
push_error("Expected TYPE_DICTIONARY for JSON in: " + config_path)
return ERR_UNCONFIGURED
else:
push_error("JSON Parse Error: ", json.get_error_message(), " in ", config_path, " at line ", json.get_error_line())
push_error(
"JSON Parse Error: ",
json.get_error_message(),
" in ",
config_path,
" at line ",
json.get_error_line()
)
return parse_return_value

var solution_name: String = config.get("files", {}).get("solution", [])[0]
Expand Down Expand Up @@ -85,6 +91,13 @@ func run_test(slug: String, exercise_dir: String, temp_dir_base_path: String) ->
push_error(JSON.stringify(results, "\t"))
return FAILED
else:
push_error("JSON Parse Error: ", json.get_error_message(), " in ", config_path, " at line ", json.get_error_line())
push_error(
"JSON Parse Error: ",
json.get_error_message(),
" in ",
config_path,
" at line ",
json.get_error_line()
)
return parse_return_value
return OK
7 changes: 3 additions & 4 deletions exercises/practice/allergies/allergies.gd
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
@export var score : int
@export var lst: Array: get = _get_lst

@export var score: int
@export var lst: Array:
get = _get_lst


func allergic_to(item):
pass



func _get_lst():
pass
2 changes: 1 addition & 1 deletion exercises/practice/luhn/luhn.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@export var card_num : String
@export var card_num: String


func valid():
Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/robot-simulator/robot_simulator.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@export var position : Vector2i
@export var direction : Vector2i
@export var position: Vector2i
@export var direction: Vector2i


func move(instructions: String):
Expand Down
3 changes: 1 addition & 2 deletions exercises/practice/save-the-cow/save_the_cow.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class SaveTheCow:

func _init(word):
pass

func guess(letter):
pass
2 changes: 1 addition & 1 deletion exercises/practice/scale-generator/scale_generator.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@export var tonic : String
@export var tonic: String


func chromatic(self):
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/simple-cipher/simple_cipher.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Cipher:

func _init(key = null):
pass

func add(a: String, b: String, reverse: bool):
pass

Expand Down
Loading