summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testdata/scad/features/ifelse-tests.scad44
-rw-r--r--tests/CMakeLists.txt3
-rw-r--r--tests/regression/cgalpngtest/ifelse-tests-expected.pngbin0 -> 9264 bytes
-rw-r--r--tests/regression/opencsgtest/ifelse-tests-expected.pngbin0 -> 9650 bytes
4 files changed, 46 insertions, 1 deletions
diff --git a/testdata/scad/features/ifelse-tests.scad b/testdata/scad/features/ifelse-tests.scad
new file mode 100644
index 0000000..d8c777b
--- /dev/null
+++ b/testdata/scad/features/ifelse-tests.scad
@@ -0,0 +1,44 @@
+if (true) cube(2, true);
+else cylinder(r=1,h=2);
+
+translate([3,0,0])
+ if (false) cylinder(r=1,h=2);
+ else cube(2, true);
+
+translate([0,3,0])
+ if (false) cylinder(r=1,h=2);
+ else if (true) cube(2, true);
+ else sphere();
+
+translate([3,3,0])
+ if (false) cylinder(r=1,h=2);
+ else if (false) sphere();
+ else cube(2, true);
+
+translate([6,0,0])
+ if (0) cylinder(r=1,h=2);
+ else cube(2, true);
+
+translate([6,3,0])
+ if (1) cube(2, true);
+ else cylinder(r=1,h=2);
+
+translate([9,0,0])
+ if ("") cylinder(r=1,h=2);
+ else cube(2, true);
+
+translate([9,3,0])
+ if ("hello") cube(2, true);
+ else cylinder(r=1,h=2);
+
+translate([12,0,0])
+ if ([]) cylinder(r=1,h=2);
+ else cube(2, true);
+
+translate([12,3,0])
+ if ([1,2,3]) cube(2, true);
+ else cylinder(r=1,h=2);
+
+translate([15,0,0])
+ if (ILLEGAL) cylinder(r=1,h=2);
+ else cube(2, true);
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 1934b86..0453fdd 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -235,7 +235,8 @@ LIST(APPEND CGALPNGTEST_FILES
${CMAKE_SOURCE_DIR}/../testdata/scad/features/projection-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/features/assign-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/features/include-tests.scad
- ${CMAKE_SOURCE_DIR}/../testdata/scad/features/child-tests.scad)
+ ${CMAKE_SOURCE_DIR}/../testdata/scad/features/child-tests.scad
+ ${CMAKE_SOURCE_DIR}/../testdata/scad/features/ifelse-tests.scad)
#LIST(APPEND CGALPNGTEST_FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad)
add_cmdline_test(cgalpngtest png ${CGALPNGTEST_FILES})
diff --git a/tests/regression/cgalpngtest/ifelse-tests-expected.png b/tests/regression/cgalpngtest/ifelse-tests-expected.png
new file mode 100644
index 0000000..fcda7bc
--- /dev/null
+++ b/tests/regression/cgalpngtest/ifelse-tests-expected.png
Binary files differ
diff --git a/tests/regression/opencsgtest/ifelse-tests-expected.png b/tests/regression/opencsgtest/ifelse-tests-expected.png
new file mode 100644
index 0000000..6dae4df
--- /dev/null
+++ b/tests/regression/opencsgtest/ifelse-tests-expected.png
Binary files differ
contact: Jan Huwald // Impressum