Cube example didn't actually work (#1478)

* Cube example didn't actually work

* Bump h2 in fuzz tests
This commit is contained in:
Adam Chalmers
2024-02-22 12:03:05 -06:00
committed by GitHub
parent 40479d177f
commit f72eb0e8a7
3 changed files with 687 additions and 191 deletions

View File

@ -1047,14 +1047,7 @@ fn store_object_with_array_property() {
#[ignore = "haven't done API calls or stdlib yet"] #[ignore = "haven't done API calls or stdlib yet"]
#[test] #[test]
fn stdlib_api_calls() { fn stdlib_api_calls() {
let program = "const x0 = startSketchAt([0, 0]) let program = include_str!("../../tests/executor/inputs/cube.kcl");
const x1 = line([0, 10], x0)
const x2 = line([10, 0], x1)
const x3 = line([0, -10], x2)
const x4 = line([0, 0], x3)
const x5 = close(x4)
const x6 = extrude(20, x5)
show(x6)";
must_plan(program); must_plan(program);
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,20 @@
fn cube = (pos, scale) => { fn cube = (length, center) => {
const sg = startSketchAt(pos) let l = length/2
|> line([0, scale], %) let x = center[0]
|> line([scale, 0], %) let y = center[1]
|> line([0, -scale], %) let p0 = [-l + x, -l + y]
let p1 = [-l + x, l + y]
let p2 = [ l + x, l + y]
let p3 = [ l + x, -l + y]
return sg return startSketchAt(p0)
|> lineTo(p1, %)
|> lineTo(p2, %)
|> lineTo(p3, %)
|> lineTo(p0, %)
|> close(%)
|> extrude(length, %)
} }
const b1 = cube([0,0], 10) const myCube = cube(40, [0,0])
const pt1 = b1[0] show(myCube)
show(b1)