* Add ID generator to ExecState
* Change default plane IDs to be hardcoded
* Fix lint warning
* Add exposing ID generator as output of executor
* Change to use generated definition of ExecState in TS
* Fix IdGenerator to use camel case in TS
* Fix TS type errors
* Add exposing id_generator parameter
* Add using the previously generated ID generator
* wip: Add display of feature tree in debug pane
* Remove artifact graph augmentation
* Change default planes to use id generator instead of hardcoded UUIDs
* Fix to reuse previously generated IDs
* Add e2e test
* Change feature tree to be collapsed by default
* Remove debug prints
* Fix unit test to use execState
* Fix type to be more general
* Remove outdated comment
* Update derive-docs output
* Fix object display component to be more general
* Remove unused ArtifactId type
* Fix test to be less brittle
* Remove codeRef and pathToNode from display
* Fix to remove test.only
Co-authored-by: Frank Noirot <frank@zoo.dev>
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)
* Move plane conversion code to be next to type
* Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)"
This reverts commit 3455cc951b
.
* Rename file
* Rename components and add doc comments
* Revive the collapse button
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)
* Confirm
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)
* Confirm
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)
* Confirm
---------
Co-authored-by: Frank Noirot <frank@zoo.dev>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import { processMemory } from './MemoryPane'
|
|
import { enginelessExecutor } from '../../../lib/testHelpers'
|
|
import { initPromise, parse, ProgramMemory } from '../../../lang/wasm'
|
|
|
|
beforeAll(async () => {
|
|
await initPromise
|
|
})
|
|
|
|
describe('processMemory', () => {
|
|
it('should grab the values and remove and geo data', async () => {
|
|
// Enable rotations #152
|
|
const code = `
|
|
const myVar = 5
|
|
fn myFn = (a) => {
|
|
return a - 2
|
|
}
|
|
const otherVar = myFn(5)
|
|
|
|
const theExtrude = startSketchOn('XY')
|
|
|> startProfileAt([0, 0], %)
|
|
|> lineTo([-2.4, myVar], %)
|
|
|> lineTo([-0.76, otherVar], %)
|
|
|> extrude(4, %)
|
|
|
|
const theSketch = startSketchOn('XY')
|
|
|> startProfileAt([0, 0], %)
|
|
|> lineTo([-3.35, 0.17], %)
|
|
|> lineTo([0.98, 5.16], %)
|
|
|> lineTo([2.15, 4.32], %)
|
|
// |> rx(90, %)`
|
|
const ast = parse(code)
|
|
const execState = await enginelessExecutor(ast, ProgramMemory.empty())
|
|
const output = processMemory(execState.memory)
|
|
expect(output.myVar).toEqual(5)
|
|
expect(output.otherVar).toEqual(3)
|
|
expect(output).toEqual({
|
|
myVar: 5,
|
|
myFn: '__function(a)__',
|
|
otherVar: 3,
|
|
theExtrude: [
|
|
{
|
|
type: 'extrudePlane',
|
|
tag: null,
|
|
id: expect.any(String),
|
|
faceId: expect.any(String),
|
|
sourceRange: [170, 194],
|
|
},
|
|
{
|
|
type: 'extrudePlane',
|
|
tag: null,
|
|
id: expect.any(String),
|
|
faceId: expect.any(String),
|
|
sourceRange: [202, 230],
|
|
},
|
|
],
|
|
theSketch: [
|
|
{ type: 'ToPoint', to: [-3.35, 0.17], from: [0, 0], tag: null },
|
|
{ type: 'ToPoint', to: [0.98, 5.16], from: [-3.35, 0.17], tag: null },
|
|
{ type: 'ToPoint', to: [2.15, 4.32], from: [0.98, 5.16], tag: null },
|
|
],
|
|
})
|
|
})
|
|
})
|