bd0f588714
Die GDExtension grovewright-bridge gibt den Kern als Klasse GwSession an GDScript weiter: Befehle einreihen, einen Takt ausführen, Karte und Inventar lesen, speichern, laden, aufzeichnen. Eine Panik im Kern macht die Sitzung defekt, statt einen guten Speicherstand zu überschreiben. Das Godot-Projekt bekommt einen Testläufer, der auch Laufzeitfehler als Fehlschlag zählt. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
20 lines
683 B
GDScript
20 lines
683 B
GDScript
class_name TestCase
|
|
extends RefCounted
|
|
## Base of every test script. Checks collect failures instead of stopping at
|
|
## the first one, so a run shows everything that is wrong.
|
|
|
|
var failures: PackedStringArray = []
|
|
## The running SceneTree, for tests that need frames or nodes.
|
|
var tree: SceneTree
|
|
|
|
|
|
func check(condition: bool, message: String) -> void:
|
|
if not condition:
|
|
failures.append(message)
|
|
|
|
|
|
## Fails unless `actual` and `expected` have the same type and value.
|
|
func check_eq(actual: Variant, expected: Variant, message: String) -> void:
|
|
if typeof(actual) != typeof(expected) or actual != expected:
|
|
failures.append("%s: expected %s, got %s" % [message, expected, actual])
|