feat: establish reproducible FreeCAD web compatibility baseline
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { test } from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import { resolve } from 'node:path'
|
||||
import { compareGoldenResult, loadGoldenManifest, validateGoldenOperation } from '../scripts/freecad-golden-contract.mjs'
|
||||
|
||||
@@ -8,9 +9,31 @@ const manifestFile = resolve('fixtures/freecad-golden/manifest.json')
|
||||
test('FreeCAD golden manifest loads unique validated scenarios', async () => {
|
||||
const manifest = await loadGoldenManifest(manifestFile)
|
||||
assert.equal(manifest.baselineId, 'freecad-1.1.1')
|
||||
assert.deepEqual(manifest.scenarios.map((entry) => entry.id), ['part-box', 'part-cylinder', 'part-sphere', 'part-cone', 'part-cut-through-hole'])
|
||||
assert.equal(manifest.scenarios.at(-1).scenario.expected.shapeType, 'Compound')
|
||||
assert.equal(manifest.scenarios.at(-1).scenario.expected.solids, 1)
|
||||
assert.equal(manifest.scenarios.length, 100)
|
||||
assert.deepEqual(manifest.scenarios.slice(0, 5).map((entry) => entry.id), ['part-box', 'part-cylinder', 'part-sphere', 'part-cone', 'part-cut-through-hole'])
|
||||
assert.equal(manifest.scenarios.find((entry) => entry.id === 'part-cut-through-hole').scenario.expected.shapeType, 'Compound')
|
||||
assert.equal(manifest.scenarios.find((entry) => entry.id === 'part-cut-through-hole').scenario.expected.solids, 1)
|
||||
})
|
||||
|
||||
test('FreeCAD failure corpus includes an invalid Common operand', async () => {
|
||||
const failureManifest = JSON.parse(await readFile(resolve('fixtures/freecad-golden/failures/manifest.json'), 'utf8'))
|
||||
assert.equal(failureManifest.failures.length, 51)
|
||||
const common = failureManifest.failures.find((entry) => entry.id === 'invalid-common-001')
|
||||
assert.ok(common)
|
||||
const fixture = JSON.parse(await readFile(resolve('fixtures/freecad-golden/failures', common.file), 'utf8'))
|
||||
assert.throws(() => validateGoldenOperation(fixture.operation, fixture.id), /must have a type/)
|
||||
})
|
||||
|
||||
test('supplemental Part family corpus validates native solid primitives and failures', async () => {
|
||||
const supplemental = await loadGoldenManifest(resolve('fixtures/freecad-golden/feature-families/manifest.json'))
|
||||
assert.equal(supplemental.scenarios.length, 5)
|
||||
assert.deepEqual(supplemental.scenarios.map((entry) => entry.scenario.operation.type), ['ellipsoid', 'torus', 'prism', 'wedge', 'helix'])
|
||||
const failures = JSON.parse(await readFile(resolve('fixtures/freecad-golden/feature-families/failures/manifest.json'), 'utf8'))
|
||||
assert.equal(failures.failures.length, 5)
|
||||
for (const entry of failures.failures) {
|
||||
const fixture = JSON.parse(await readFile(resolve('fixtures/freecad-golden/feature-families/failures', entry.file), 'utf8'))
|
||||
assert.throws(() => validateGoldenOperation(fixture.operation, fixture.id))
|
||||
}
|
||||
})
|
||||
|
||||
test('golden comparator applies linear and scalar tolerances only to declared oracle fields', async () => {
|
||||
|
||||
Reference in New Issue
Block a user