Add CI pipeline and reusable test harness
A Gitea Actions workflow (.gitea/workflows/ci.yml) running the headless test suite on push, plus shared test scaffolding: seeded-RNG / approx / tally helpers (test_helpers.gd), a harness self-test, and a resolution + pseudo-locale UI-layout robustness guard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CCyaJPTHCH9EDthpf4A5Sj
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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())
|
||||
Reference in New Issue
Block a user