renames sketch group/extrude group (#4016)
* renames Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fixups Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> udpates Signed-off-by: Jess Frazelle <github@jessfraz.com> fix parse Signed-off-by: Jess Frazelle <github@jessfraz.com> fix typos Signed-off-by: Jess Frazelle <github@jessfraz.com> docs Signed-off-by: Jess Frazelle <github@jessfraz.com> update tests Signed-off-by: Jess Frazelle <github@jessfraz.com> empty * fix; Signed-off-by: Jess Frazelle <github@jessfraz.com> * new Signed-off-by: Jess Frazelle <github@jessfraz.com> * add the types pages Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * Look at this (photo)Graph *in the voice of Nickelback* * empty * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -3,9 +3,9 @@ import fs from 'node:fs'
|
||||
import {
|
||||
parse,
|
||||
ProgramMemory,
|
||||
SketchGroup,
|
||||
Sketch,
|
||||
initPromise,
|
||||
sketchGroupFromKclValue,
|
||||
sketchFromKclValue,
|
||||
} from './wasm'
|
||||
import { enginelessExecutor } from '../lib/testHelpers'
|
||||
import { KCLError } from './errors'
|
||||
@ -125,12 +125,12 @@ const newVar = myVar + 1`
|
||||
// ].join('\n')
|
||||
// const mem = await exe(code)
|
||||
// expect(mem.get('mySk1')?.value).toHaveLength(3)
|
||||
// expect(mem.get('rotated')?.type).toBe('SketchGroup')
|
||||
// expect(mem.get('rotated')?.type).toBe('Sketch')
|
||||
// if (
|
||||
// mem.get('mySk1')?.type !== 'SketchGroup' ||
|
||||
// mem.get('rotated')?.type !== 'SketchGroup'
|
||||
// mem.get('mySk1')?.type !== 'Sketch' ||
|
||||
// mem.get('rotated')?.type !== 'Sketch'
|
||||
// )
|
||||
// throw new Error('not a sketch group')
|
||||
// throw new Error('not a sketch')
|
||||
// expect(mem.get('mySk1')?.rotation).toEqual([0, 0, 0, 1])
|
||||
// expect(mem.get('rotated')?.rotation.map((a) => a.toFixed(4))).toEqual([
|
||||
// '0.7071',
|
||||
@ -154,7 +154,7 @@ const newVar = myVar + 1`
|
||||
expect(mem.get('mySk1')).toEqual({
|
||||
type: 'UserVal',
|
||||
value: {
|
||||
type: 'SketchGroup',
|
||||
type: 'Sketch',
|
||||
on: expect.any(Object),
|
||||
start: {
|
||||
to: [0, 0],
|
||||
@ -368,9 +368,9 @@ describe('testing math operators', () => {
|
||||
'|> line([-2.21, -legLen(5, min(3, 999))], %)',
|
||||
].join('\n')
|
||||
const mem = await exe(code)
|
||||
const sketch = sketchGroupFromKclValue(mem.get('part001'), 'part001')
|
||||
const sketch = sketchFromKclValue(mem.get('part001'), 'part001')
|
||||
// result of `-legLen(5, min(3, 999))` should be -4
|
||||
const yVal = (sketch as SketchGroup).value?.[0]?.to?.[1]
|
||||
const yVal = (sketch as Sketch).value?.[0]?.to?.[1]
|
||||
expect(yVal).toBe(-4)
|
||||
})
|
||||
it('test that % substitution feeds down CallExp->ArrExp->UnaryExp->CallExp', async () => {
|
||||
@ -386,24 +386,22 @@ describe('testing math operators', () => {
|
||||
``,
|
||||
].join('\n')
|
||||
const mem = await exe(code)
|
||||
const sketch = sketchGroupFromKclValue(mem.get('part001'), 'part001')
|
||||
const sketch = sketchFromKclValue(mem.get('part001'), 'part001')
|
||||
// expect -legLen(segLen('seg01'), myVar) to equal -4 setting the y value back to 0
|
||||
expect((sketch as SketchGroup).value?.[1]?.from).toEqual([3, 4])
|
||||
expect((sketch as SketchGroup).value?.[1]?.to).toEqual([6, 0])
|
||||
expect((sketch as Sketch).value?.[1]?.from).toEqual([3, 4])
|
||||
expect((sketch as Sketch).value?.[1]?.to).toEqual([6, 0])
|
||||
const removedUnaryExp = code.replace(
|
||||
`-legLen(segLen(seg01), myVar)`,
|
||||
`legLen(segLen(seg01), myVar)`
|
||||
)
|
||||
const removedUnaryExpMem = await exe(removedUnaryExp)
|
||||
const removedUnaryExpMemSketch = sketchGroupFromKclValue(
|
||||
const removedUnaryExpMemSketch = sketchFromKclValue(
|
||||
removedUnaryExpMem.get('part001'),
|
||||
'part001'
|
||||
)
|
||||
|
||||
// without the minus sign, the y value should be 8
|
||||
expect((removedUnaryExpMemSketch as SketchGroup).value?.[1]?.to).toEqual([
|
||||
6, 8,
|
||||
])
|
||||
expect((removedUnaryExpMemSketch as Sketch).value?.[1]?.to).toEqual([6, 8])
|
||||
})
|
||||
it('with nested callExpression and binaryExpression', async () => {
|
||||
const code = 'const myVar = 2 + min(100, -1 + legLen(5, 3))'
|
||||
|
Reference in New Issue
Block a user