Files
claudeandClaude Opus 5.5 779fbe8c30
test / test (push) Successful in 1m59s
Underworld: ash floors and pockets, a lava sea, emberite ore
- Layer rows can name a floor cover, soft pockets and a sea row. The
  underworld uses ash for both, and every cave cell at or below
  WORLD_BOTTOM + 28 is lava: a sea that is held in on every side, so it
  doesn't flow when woken.
- Emberite ore in basalt (about 1.5% of the layer): glows, group
  level 4, so no current pickaxe (maxlevel 3) digs it. It waits for the
  top pre-hard-mode pickaxe in v0.5.
- Ruined towers move to the structure framework (#24).

Tests: 3 new cases in tests/underworld.lua (emberite tool gate, the lava
sea, ash floors/pockets and ore share); the layer tests accept the
underworld's ash. 109/109 pass, no ERROR lines.

Closes #25

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:34:48 -05:00
..
2026-11-15 01:29:33 -05:00

Strata tests

Headless only: the graphical client is never started.

tests/run.sh [scratch_dir]

run.sh builds a throwaway world in scratch_dir (a fresh mktemp -d by default), exposes this checkout as games/strata through MINETEST_GAME_PATH, copies strata_selftest/ into the world's worldmods/ and runs a dedicated server. The selftest emerges a test area, runs every case, prints one TEST pass <name> or FAIL <name>: <reason> line per case and a TEST summary, then shuts the server down.

A run passes only with zero FAIL lines, zero ERROR lines in the server output, a summary line and a clean exit.

Variable Default Purpose
LUANTI first of luanti, luantiserver, … on PATH (+/usr/games) engine binary
STRATA_TEST_PORT 30777 UDP port, change it to run several at once
STRATA_TEST_TIMEOUT 420 seconds before the run is killed and failed
STRATA_TEST_FILTER empty Lua pattern; only run cases whose name matches

Lint with luacheck . (config in .luacheckrc). CI runs both in .gitea/workflows/test.yml on a debian:trixie container (Luanti 5.10).

Writing tests

Add cases to a file in strata_selftest/tests/ (and list new files in strata_selftest/init.lua):

selftest.register("area: what it checks", function(t)
	t.eq(core.get_node({x = 0, y = 0, z = 0}).name, "strata_core:stone", "node")
	t.assert(cond, "message")
end)

-- Async: call t.done() when finished. t.after(sec, f) and t.wrap(f) make
-- callbacks report their errors as a FAIL of this case.
-- A case gets 20 s; pass {async = true, timeout = <seconds>} for slow ones
-- (the CI runner generates map several times slower than a desktop).
selftest.register("area: something over time", function(t)
	t.after(1, function()
		t.assert(cond, "message")
		t.done()
	end)
end, {async = true})

The area selftest.AREA_MIN..selftest.AREA_MAX is emerged before the first case runs, at a fixed seed (1337) and noon (time_speed = 0).