import { test } from 'node:test'; import assert from 'node:assert/strict'; import { createSummitWalking } from '../src/controls/summitWalking.ts'; import { structurePosition } from '../src/scene/structures.ts'; import { SUMMIT_TERRAIN } from '../src/constants/summitTerrain.ts'; const origin = { latitude: 37.445, longitude: 126.964 }; const walking = createSummitWalking(origin); const start = structurePosition(SUMMIT_TERRAIN.start.latitude, SUMMIT_TERRAIN.start.longitude, origin); test('estimated start connects to the mapped public summit route', () => { const junction = structurePosition(37.4447614,126.9641235,origin); assert.ok(walking.canTraverse(start,junction)); for (const route of walking.routes) for (let i=1;i { const radar = structurePosition(37.444028,126.963808,origin); assert.equal(walking.walkable(radar.x,radar.z),false); assert.equal(walking.walkable(start.x+201,start.z),false); assert.equal(walking.canTraverse(start,{x:start.x+80,z:start.z}),false); const north=structurePosition(37.4449609,126.9641628,origin); const east=structurePosition(37.4448264,126.9646956,origin); assert.equal(walking.canTraverse(north,east),false,'cannot cut the corner between valid endpoints'); }); test('summit slab allows lateral movement beside the peak and connects to the lower forecourt', () => { // OSM peak is north of the estimated camera; photos show a broad slab, not just a trail. const peak = structurePosition(37.4451398,126.9642379,origin); const eastSlab = { x: peak.x+7, z: peak.z+4 }; const westSlab = { x: peak.x-12, z: peak.z+4 }; assert.ok(walking.canTraverse(westSlab,eastSlab),'cross the upper slab beside the summit marker'); assert.ok(walking.canTraverse(start,eastSlab),'lower forecourt joins the summit slab'); const mast = structurePosition(37.4450675,126.9638043,origin); assert.equal(walking.walkable(mast.x,mast.z),false,'mast compound remains excluded'); assert.equal(walking.walkable(peak.x+30,peak.z),false,'eastern cliff is not part of the slab'); }); test('visible summit slab stops at its walking edge and the marker footprint is blocked', () => { const outside={x:start.x-32,z:start.z-34}; assert.equal(walking.onPlatform(outside.x,outside.z),false); assert.ok(walking.rockDistance(outside.x,outside.z)>0,'no circular rock patch beyond the slab boundary'); assert.equal(walking.walkable(start.x-12,start.z-22),false,'cannot walk through the summit stone'); assert.ok(walking.walkable(start.x-15,start.z-22),'can walk beside the stone'); });