Targets met without a spatial grid: polygon+cells 0.048 ms (<= 0.451) on the prototype scene, polygon 0.083 ms (< 1 ms) on 5k sparse. 5k dense stress layout reported (1.28 ms). Logs: results/bench.log, nimble-test.log. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
24 lines
856 B
Nim
24 lines
856 B
Nim
import std/unittest
|
|
import std/math
|
|
import geometry
|
|
import ../tools/scenegen
|
|
|
|
suite "scenegen (bench scenes)":
|
|
test "exactly n walls, deterministic per seed, seeds differ":
|
|
let a = genScene(16384, 5000, 1)
|
|
check a.len == 5000
|
|
check a == genScene(16384, 5000, 1)
|
|
check a != genScene(16384, 5000, 2)
|
|
test "doors are every 10th wall, all closed; walls stay inside the world (+- jitter)":
|
|
let a = genScene(4096, 5000, 1)
|
|
var doors = 0
|
|
for i, w in a:
|
|
check w.door == (i mod 10 == 9)
|
|
check not w.open
|
|
for p in [w.a, w.b]: check p.x >= -6 and p.x <= 4096 + 6 and p.y >= -6 and p.y <= 4096 + 6
|
|
if w.door: inc doors
|
|
check doors == 500
|
|
test "walls are non-degenerate and axis-ish segments of room-edge length":
|
|
for w in genScene(16384, 5000, 1):
|
|
check hypot(w.b.x - w.a.x, w.b.y - w.a.y) > 100
|