diff options
Diffstat (limited to 'testdata/scad/misc')
-rw-r--r-- | testdata/scad/misc/allexpressions.scad | 30 | ||||
-rw-r--r-- | testdata/scad/misc/allfunctions.scad | 28 | ||||
-rw-r--r-- | testdata/scad/misc/allmodules.scad | 39 | ||||
-rw-r--r-- | testdata/scad/misc/expression-shortcircuit-tests.scad | 27 |
4 files changed, 124 insertions, 0 deletions
diff --git a/testdata/scad/misc/allexpressions.scad b/testdata/scad/misc/allexpressions.scad new file mode 100644 index 0000000..f618c4b --- /dev/null +++ b/testdata/scad/misc/allexpressions.scad @@ -0,0 +1,30 @@ +a = true; +b = false; +c = undef; +d = a; +e = $fn; +f1 = [1,,]; +f2 = [1,2,3]; +g = f2.x + f2.y + f2.z; +h1 = [2:5]; +h2 = [1:2:10]; +i = h2.begin - h2.step - h2.end; +j = "test"; +k = 1.23e-2; +l = a * b; +m = a / b; +n = a % b; +o = c < d; +p = c <= d; +q = c == d; +r = c != d; +s = c >= d; +t = c > d; +u = e && g; +v = e || g; +w = +i; +x = -i; +y = !i; +z = (j); +aa = k ? l : m; +bb = n[o]; diff --git a/testdata/scad/misc/allfunctions.scad b/testdata/scad/misc/allfunctions.scad new file mode 100644 index 0000000..b97f121 --- /dev/null +++ b/testdata/scad/misc/allfunctions.scad @@ -0,0 +1,28 @@ +a = abs(); +b = sign(); +c = rands(); +d = min(); +e = max(); +f = sin(); +g = cos(); +h = asin(); +i = acos(); +j = tan(); +k = atan(); +l = atan2(); +m = round(); +n = ceil(); +o = floor(); +p = pow(); +q = sqrt(); +r = exp(); +s = log(); +t = ln(); +u = str(); +v = lookup(); +w = dxf_dim(); +x = dxf_cross(); +y = version(); +z = version_num(); +aa = len(); +bb = search(); diff --git a/testdata/scad/misc/allmodules.scad b/testdata/scad/misc/allmodules.scad new file mode 100644 index 0000000..2e38d8f --- /dev/null +++ b/testdata/scad/misc/allmodules.scad @@ -0,0 +1,39 @@ +minkowski(); +glide(); +subdiv(); +hull(); +resize(); +child(); +echo(); +assign(); +for(); +intersection_for(); +if(false) { cube(); } else { sphere(); } +union(); +difference(); +intersection(); +dxf_linear_extrude(); +linear_extrude(); +dxf_rotate_extrude(); +rotate_extrude(); +import(); +import_stl(); +import_off(); +import_dxf(); +group(); +cube(); +sphere(); +cylinder(); +polyhedron(); +square(); +circle(); +polygon(); +projection(); +render(); +surface(); +scale(); +rotate(); +mirror(); +translate(); +multmatrix(); +color(); diff --git a/testdata/scad/misc/expression-shortcircuit-tests.scad b/testdata/scad/misc/expression-shortcircuit-tests.scad new file mode 100644 index 0000000..dd5a1d5 --- /dev/null +++ b/testdata/scad/misc/expression-shortcircuit-tests.scad @@ -0,0 +1,27 @@ +function foo() = search(undef,undef); + +if (false && foo()) { + echo("Fail"); +} else { + echo("Pass"); +} + +if (true || foo()) { + echo("Pass"); +} else { + echo("Fail"); +} + +if (true && true) { + echo("Pass"); +} + +if (false || true) { + echo("Pass"); +} + +function ternarytest() = true ? true : foo(); + +if (ternarytest()) { + echo("Pass"); +} |