tests: the restart and logs groups, the nine-group checklist and the fixture clean-up (#25)

This commit is contained in:
2026-11-15 12:52:20 +01:00
parent 70a984c55a
commit cedb80aa96
7 changed files with 474 additions and 13 deletions
+1 -11
View File
@@ -3,9 +3,7 @@
"w": 4096,
"h": 4096
},
"tileSize": 256,
"visionRadius": 400,
"tokenRadius": 20,
"exploredCell": 32,
"walls": [
{
@@ -871,7 +869,6 @@
],
"tokens": [
{
"id": "A",
"kind": "player",
"name": "Player A",
"pos": [
@@ -881,7 +878,6 @@
"gmOnly": false
},
{
"id": "B",
"kind": "player",
"name": "Player B",
"pos": [
@@ -891,7 +887,6 @@
"gmOnly": false
},
{
"id": "M1",
"kind": "monster",
"name": "Monster 1",
"pos": [
@@ -901,7 +896,6 @@
"gmOnly": true
},
{
"id": "M2",
"kind": "monster",
"name": "Monster 2",
"pos": [
@@ -911,7 +905,6 @@
"gmOnly": true
},
{
"id": "M3",
"kind": "monster",
"name": "Monster 3",
"pos": [
@@ -921,7 +914,6 @@
"gmOnly": true
},
{
"id": "M4",
"kind": "monster",
"name": "Monster 4",
"pos": [
@@ -931,7 +923,6 @@
"gmOnly": true
},
{
"id": "M5",
"kind": "monster",
"name": "Monster 5",
"pos": [
@@ -941,7 +932,6 @@
"gmOnly": true
},
{
"id": "M6",
"kind": "monster",
"name": "Monster 6",
"pos": [
@@ -951,4 +941,4 @@
"gmOnly": true
}
]
}
}
+6 -1
View File
@@ -199,6 +199,11 @@ type Scene = object
tokens: seq[Vec]
radius, cell, tokenRadius: float
const PrototypeTokenRadius = 20.0
## The prototype scene's scene-wide token radius. It is a *fixture* value since slice 10 (#25):
## M3 has a per-token radius (5.6, #4) and no scene-wide fixture field, so the JSON no longer
## carries one (nor its stale `tileSize`, nor index token ids). Only this seed test uses it.
proc loadScene(): Scene =
# fixtures are copies of prototype-server-vision/data/scene.json; a missing file fails, never skips
let j = parseFile(currentSourcePath().parentDir / "fixtures" / "scene.json")
@@ -208,7 +213,7 @@ proc loadScene(): Scene =
for t in j["tokens"]: result.tokens.add (t["pos"][0].getFloat, t["pos"][1].getFloat)
result.radius = j["visionRadius"].getFloat
result.cell = j["exploredCell"].getFloat
result.tokenRadius = j["tokenRadius"].getFloat
result.tokenRadius = PrototypeTokenRadius
suite "seed":
test "every token in seed sees itself and is not walled in":