extends SceneTree ## Proves tests/test_helpers.gd behaves before the rest of the suite leans on it: seeded RNGs are ## reproducible, the approx comparisons accept tiny error and reject real gaps, and the tally maps ## onto the exit code. It dogfoods the tally it is testing. ## Run: godot --headless --script tests/harness_selftest.gd const TH := preload("res://tests/test_helpers.gd") func _init() -> void: _run.call_deferred() func _run() -> void: var t := TH.new() var same_a := TH.make_rng(42) var same_b := TH.make_rng(42) t.ok(same_a.randf() == same_b.randf(), "same seed yields the same draw") t.ok(TH.make_rng(42).randi() != TH.make_rng(7).randi(), "different seeds diverge") t.ok(TH.approx(0.1 + 0.2, 0.3), "approx tolerates float rounding error") t.ok(not TH.approx(1.0, 1.5, 0.1), "approx rejects a real gap") t.ok(TH.vec_approx(Vector3(1, 2, 3), Vector3(1, 2, 3.00001)), "vec_approx tolerates a tiny offset") t.ok(not TH.vec_approx(Vector3.ZERO, Vector3(0, 0, 1)), "vec_approx rejects a real offset") quit(t.report())