render3d: ground_fill's conformance test and the generator of its golden
tests/ground_fill_test.ludic compares gg_json (gf_hash over fixed inputs, Math.lerp cases whose order matters, the yaw as model.vert turns by it, a hand-written density, one cover chunk with a clearing and one solid chunk) line for line with tests/ground_fill_golden.json, and checks ground_fill draws exactly the candidates and a solid layer's far bands a subset of band 0. The golden is written by tests/gen/ground_fill_golden.ludic, run from the repository root; it is not committed here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e535879262
commit
54e267dfa6
6 changed files with 362 additions and 0 deletions
21
packages/ludic.render3d/tests/gen/ground_fill_golden.ludic
Normal file
21
packages/ludic.render3d/tests/gen/ground_fill_golden.ludic
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# gen/ground_fill_golden.ludic - writes tests/ground_fill_golden.json from what ground_fill grows today. Run it
|
||||
# from the repository root after a deliberate change to the fill, and commit the file with the change.
|
||||
import "ludic.render3d/r3d.ludic"
|
||||
program GroundFillGolden {
|
||||
numbers float
|
||||
import "../fakes/ground_golden.ludic"
|
||||
import "../fakes/ground_golden_json.ludic"
|
||||
import "../fakes/ground_golden_things.ludic"
|
||||
# never called: naming Input links the engine's runtime, which render3d's textures stand on
|
||||
function links_runtime() -> bool { return Input.key_pressed(0) }
|
||||
|
||||
entry (render3d_st: mut Render3dState) {
|
||||
if not gg_open(render3d_st, "write") {
|
||||
print("ground_fill_golden: the density could not be written")
|
||||
return
|
||||
}
|
||||
let path = "packages/ludic.render3d/tests/ground_fill_golden.json"
|
||||
let text = gg_json(render3d_st)
|
||||
if Fs.write_text(path, text) { print(`ground_fill_golden: wrote {path}`) } else { print(`ground_fill_golden: could not write {path}`) }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue