import { readFile } from 'node:fs/promises' import { resolve } from 'node:path' const root = resolve(new URL('..', import.meta.url).pathname) const report = JSON.parse(await readFile(resolve(root, 'config/freecad-property-acceleration-success.json'), 'utf8')) const fail = (message) => { throw new Error(`FreeCAD PropertyAcceleration success check failed: ${message}`) } if (report.schemaVersion !== 1 || report.status !== 'pass' || report.baselineId !== 'freecad-1.1.1-property-acceleration-success' || report.freecadVersion !== '1.1.1' || report.gitCommit !== '0108fd4b4850cc46e625b60e53cea7a7bbe69f8d') fail('baseline is invalid') if (report.object?.typeId !== 'Robot::TrajectoryDressUpObject' || report.property?.name !== 'Acceleration' || report.property?.typeId !== 'App::PropertyAcceleration' || report.property?.group !== 'TrajectoryDressUp') fail('native object/property identity changed') if (report.diagnostics?.exception !== null || report.diagnostics?.documentObjectCount !== 1 || report.cases?.length !== 4) fail('native success cases are incomplete') const byId = new Map(report.cases.map((entry) => [entry.id, entry])) for (const id of ['default', 'nominal', 'lower-bound', 'negative-boundary']) if (!byId.has(id)) fail(`missing case ${id}`) for (const entry of report.cases) { if (entry.typeId !== 'App::PropertyAcceleration' || entry.group !== 'TrajectoryDressUp' || JSON.stringify(entry.status) !== '[]' || JSON.stringify(entry.editorMode) !== '[]' || entry.shape?.applicable !== false || !Array.isArray(entry.objectState)) fail(`${entry.id} native metadata is invalid`) if (typeof entry.value?.unit !== 'string' || !entry.value.unit.includes('mm/s^2') || typeof entry.value.numeric !== 'number' || !Number.isFinite(entry.value.numeric)) fail(`${entry.id} quantity result is invalid`) } if (byId.get('default').value.numeric !== 1000 || byId.get('nominal').value.numeric !== 500 || byId.get('lower-bound').value.numeric !== 0 || byId.get('negative-boundary').value.numeric !== -500) fail('nominal or boundary values changed') console.log(JSON.stringify({ status: 'freecad-property-acceleration-success-pass', cases: report.cases.length, nominal: byId.get('nominal').value, boundary: [byId.get('lower-bound').value, byId.get('negative-boundary').value] }, null, 2))