summaryrefslogtreecommitdiff
path: root/testdata
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-10-13 17:19:34 (GMT)
committerMarius Kintel <marius@kintel.net>2013-10-13 17:19:34 (GMT)
commite77615be3027cfe365e3e52f3ed609dae9711028 (patch)
tree21babea118b3bc59037e4e487a4c6bd6811b5412 /testdata
parent0f22d6e9ad562e87ae484a82df56ddee30e87343 (diff)
parent4401a136b9cbf01aa99cfdf5d9d67d62579dd853 (diff)
Merge branch 'children' of git://github.com/vicnet/openscad into vicnet-children
Conflicts: tests/CMakeLists.txt
Diffstat (limited to 'testdata')
-rw-r--r--testdata/scad/misc/children-tests.scad64
1 files changed, 64 insertions, 0 deletions
diff --git a/testdata/scad/misc/children-tests.scad b/testdata/scad/misc/children-tests.scad
new file mode 100644
index 0000000..a9a3cf9
--- /dev/null
+++ b/testdata/scad/misc/children-tests.scad
@@ -0,0 +1,64 @@
+
+module child1() {
+ echo("child1");
+}
+module child2() {
+ echo("child2");
+}
+module child3() {
+ echo("child3");
+}
+module child4() {
+ echo("child4");
+}
+module child5() {
+ echo("child5");
+}
+
+module test_children_empty() {
+ echo("Children empty: begin");
+ children();
+ echo("Children empty: end");
+}
+test_children_empty() {
+ child1();child2();child3();child4();child5();
+}
+
+module test_children_scalar() {
+ echo("Children scalar: begin");
+ children(0); // child1
+ children(4); // child5
+ children(2); // child3
+ children(5); // out
+ children(-1); // out
+ echo("Children scalar: end");
+}
+test_children_scalar() {
+ child1();child2();child3();child4();child5();
+}
+
+module test_children_vector() {
+ echo("Children vector: begin");
+ children([4]); // child5 last
+ children([0,3,1]); // child1, child4, child2
+ children([5,-1]); // out, out
+ echo("Children vector: end");
+}
+test_children_vector() {
+ child1();child2();child3();child4();child5();
+}
+
+module test_children_range() {
+ echo("Children range: begin");
+ children([0:4]); // all
+ children([1:2]); // child2, child3
+ children([0:2:4]); // child1, child3, child5
+ children([4:-1:0]); // out, out
+ echo("Children range: end");
+}
+test_children_range() {
+ child1();child2();child3();child4();child5();
+}
+
+// to avoid no object error
+cube(1.0);
contact: Jan Huwald // Impressum