summaryrefslogtreecommitdiff
path: root/testdata
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2014-01-03 18:17:58 (GMT)
committerMarius Kintel <marius@kintel.net>2014-01-03 18:17:58 (GMT)
commitbee5233a916055d41bb4ee425f5df25b80f50f16 (patch)
tree7bfac9716f778ed685e62e2d0830d1905bc08fd2 /testdata
parentf093b53c3edb08ee0d64c5d6c2a1df723acfca2d (diff)
parentc5223417e3ffe965d09d971865797206080eb0ae (diff)
Merge branch 'vector-concat' of git://github.com/t-paul/openscad into t-paul-vector-concat
Conflicts: src/Preferences.ui
Diffstat (limited to 'testdata')
-rw-r--r--testdata/scad/experimental/concat-tests.scad53
1 files changed, 53 insertions, 0 deletions
diff --git a/testdata/scad/experimental/concat-tests.scad b/testdata/scad/experimental/concat-tests.scad
new file mode 100644
index 0000000..0bcb903
--- /dev/null
+++ b/testdata/scad/experimental/concat-tests.scad
@@ -0,0 +1,53 @@
+u = undef;
+
+echo("--- empty");
+echo(concat());
+echo(concat([]));
+echo(concat([], []));
+echo(concat([], [], []));
+
+echo("--- single elements");
+echo(concat(u));
+echo(concat(true));
+echo(concat(3));
+echo(concat("abc"));
+echo(concat([0:1:10]));
+
+echo("--- single vectors");
+echo(concat([1, 2, 3]));
+echo(concat([[1, 2, 3]]));
+echo(concat([[[1, 2, 3]]]));
+echo(concat([[[1, 2, [3, 4], 5]]]));
+
+echo("--- multiple elements");
+echo(concat(3, 3));
+echo(concat(1, 2, 3));
+echo(concat(1, 2, 3, 4, 5));
+echo(concat(1, "text", false, [1:0.5:3]));
+
+echo("--- vector / element");
+echo(concat([3, 4], u));
+echo(concat([3, 4, 5], 6));
+echo(concat([3, 4, 5, 6], true));
+echo(concat([3, 4, "5", 6], "test"));
+echo(concat([3, 4, true, 6], [4:1:3]));
+
+echo("--- element / vector");
+echo(concat(3, []));
+echo(concat(3, [3, 4]));
+echo(concat(true, [3, [4]]));
+echo(concat("9", [1, 2, 3]));
+echo(concat([6:2:9], [3, [4]]));
+
+echo("--- vector / vector");
+echo(concat([], [3, 4]));
+echo(concat([[]], [3, 4]));
+echo(concat([[2, 4]], [3, 4]));
+echo(concat([5, 6], ["d", [3, 4]]));
+echo(concat([[1, 0, 0], [2, 0, 0]], [3, 0, 0]));
+echo(concat([[1, 0, 0], [2, 0, 0]], [[3, 0, 0]]));
+echo(concat([[1, 0, 0], [2, 0, 0], [3, 0, 0]], [[4, 4, 4], [5, 5, 5]]));
+
+echo("--- recursive function");
+function r(i) = i > 0 ? concat(r(i - 1), [[i, i * i]]) : [];
+echo(r(10));
contact: Jan Huwald // Impressum