43 lines
1.9 KiB
GDScript
43 lines
1.9 KiB
GDScript
extends SceneTree
|
|
|
|
var failures := 0
|
|
|
|
|
|
func _initialize() -> void:
|
|
var service = load("res://scripts/autoload/block_session_service.gd").new()
|
|
var question := {
|
|
"id": "review-test-question",
|
|
"system": "Test System",
|
|
"choices": [
|
|
{"id": "A", "text": "Correct"},
|
|
{"id": "B", "text": "Wrong"},
|
|
{"id": "C", "text": "Wrong"},
|
|
{"id": "D", "text": "Wrong"},
|
|
{"id": "E", "text": "Wrong"}
|
|
],
|
|
"correct_choice_id": "A"
|
|
}
|
|
_assert(service.start_review_question(question), "review session should start")
|
|
_assert(service.session_kind == "review", "review session should have its own kind")
|
|
var wrong: Dictionary = service.submit_review_attempt("B", [], false)
|
|
_assert(bool(wrong.get("first_submission", false)), "the first review answer should be marked as the queue outcome")
|
|
_assert(not bool(wrong.get("is_correct", true)), "a wrong review should remain retryable")
|
|
_assert(service.get_answer_for_index(0) == null, "a wrong review should not finalize the question")
|
|
var correct: Dictionary = service.submit_review_attempt("A", [], false)
|
|
_assert(not bool(correct.get("first_submission", true)), "a retry must not replace the first review outcome")
|
|
_assert(bool(correct.get("is_correct", false)), "the correct retry should resolve the question UI")
|
|
_assert(service.get_answer_for_index(0) != null, "the resolved review should remain available for explanation review")
|
|
_assert(service.replace_review_question(question), "the next review question should replace the current one")
|
|
var next_correct: Dictionary = service.submit_review_attempt("A", [], false)
|
|
_assert(bool(next_correct.get("first_submission", false)), "a new review exposure should accept a new first outcome")
|
|
_assert(service.finish_block().is_empty(), "review sessions should not calculate progression rewards")
|
|
service.free()
|
|
quit(1 if failures > 0 else 0)
|
|
|
|
|
|
func _assert(condition: bool, message: String) -> void:
|
|
if condition:
|
|
return
|
|
failures += 1
|
|
push_error(message)
|