diff options
Diffstat (limited to 'testdata')
34 files changed, 185 insertions, 0 deletions
diff --git a/testdata/modulecache-tests/README.txt b/testdata/modulecache-tests/README.txt new file mode 100644 index 0000000..277cff8 --- /dev/null +++ b/testdata/modulecache-tests/README.txt @@ -0,0 +1,81 @@ +Some work is needed to include these into the automated test suite. +For now, run them manually according to these instructions: + +Compile OpenSCAD in debug mode. This will give console output related to module caching, e.g.: +/path/to/used.scad: 0x103612f70 +Module cache size: 1 modules + +Test1: Basic cache +------ + +o Open use.scad +o Compile twice (F5) - check that module reference is the same + +Test2: Dependency tracking of USE +------ + +o Open use.scad +o Compile (F5) +o touch used.scad +o Compile (F5) - check that the module reference changed + +Test3: MCAD +------ + +o Open use-mcad.scad +o Compile (F5) +o Check that you get a rounded box + +Test4: USE Non-existing file +------ + +o Open usenonexsistingfile.scad +o Compile (F5) +o Verify that you get: WARNING: Can't open 'use' file 'nofile.scad'. + +Test5: Overload USEd module +------ + +o Open moduleoverload.scad +o Compile (F5) +o Verify that you get a sphere rather than a cylinder + +Test6: Recursive USE +------ + +o Open recursivemain.scad +o Compile (F5) +o Verify that OpenSCAD won't hang or crash + +Test7: Circular USE +------ + +o Open circularmain.scad +o Compile (F5) +o Verify that OpenSCAD won't hang or crash + +Test8: Dependency tracking of common file USEd by multiple modules +------ + +o Open multiplemain.scad +o Compile (F5) - verify that you get a sphere and a cube of approximately the same size +o Edit multipleB.scad: + - cube(1.5*F(), center=true); + + cube(2.5*F(), center=true); +o Reload and Compile (F4) - verify that the cube got larger + +Test9: Dependency tracking of file included from module +------ + +o Open includefrommodule.scad +o Compile (F5) - Verify that you get a circular disc +o Edit radius.scad: Change RADIUS +o Compile (F5) - Verify that the disc changed size + +Test9: Circular include +------ + +o Open circularincludemain.scad +o Compile (F5) +o Verify that OpenSCAD won't hang or crash + diff --git a/testdata/modulecache-tests/circularfirst.scad b/testdata/modulecache-tests/circularfirst.scad new file mode 100644 index 0000000..90052a9 --- /dev/null +++ b/testdata/modulecache-tests/circularfirst.scad @@ -0,0 +1 @@ +use <circularsecond.scad> diff --git a/testdata/modulecache-tests/circularincludefirst.scad b/testdata/modulecache-tests/circularincludefirst.scad new file mode 100644 index 0000000..f94606a --- /dev/null +++ b/testdata/modulecache-tests/circularincludefirst.scad @@ -0,0 +1 @@ +include <circularincludesecond.scad> diff --git a/testdata/modulecache-tests/circularincludemain.scad b/testdata/modulecache-tests/circularincludemain.scad new file mode 100644 index 0000000..b973956 --- /dev/null +++ b/testdata/modulecache-tests/circularincludemain.scad @@ -0,0 +1 @@ +include <circularincludefirst.scad> diff --git a/testdata/modulecache-tests/circularincludesecond.scad b/testdata/modulecache-tests/circularincludesecond.scad new file mode 100644 index 0000000..b973956 --- /dev/null +++ b/testdata/modulecache-tests/circularincludesecond.scad @@ -0,0 +1 @@ +include <circularincludefirst.scad> diff --git a/testdata/modulecache-tests/circularmain.scad b/testdata/modulecache-tests/circularmain.scad new file mode 100644 index 0000000..feb9dde --- /dev/null +++ b/testdata/modulecache-tests/circularmain.scad @@ -0,0 +1 @@ +use <circularfirst.scad> diff --git a/testdata/modulecache-tests/circularsecond.scad b/testdata/modulecache-tests/circularsecond.scad new file mode 100644 index 0000000..feb9dde --- /dev/null +++ b/testdata/modulecache-tests/circularsecond.scad @@ -0,0 +1 @@ +use <circularfirst.scad> diff --git a/testdata/modulecache-tests/includefrommodule.scad b/testdata/modulecache-tests/includefrommodule.scad new file mode 100644 index 0000000..70bd804 --- /dev/null +++ b/testdata/modulecache-tests/includefrommodule.scad @@ -0,0 +1,3 @@ +use <modulewithinclude.scad> + +mymodule(); diff --git a/testdata/modulecache-tests/moduleoverload.scad b/testdata/modulecache-tests/moduleoverload.scad new file mode 100644 index 0000000..1928715 --- /dev/null +++ b/testdata/modulecache-tests/moduleoverload.scad @@ -0,0 +1,7 @@ +use <mymodule-lib.scad> + +module mymodule() { + sphere(); +} + +mymodule(); diff --git a/testdata/modulecache-tests/modulewithinclude.scad b/testdata/modulecache-tests/modulewithinclude.scad new file mode 100644 index 0000000..17ff74a --- /dev/null +++ b/testdata/modulecache-tests/modulewithinclude.scad @@ -0,0 +1,5 @@ +include <radius.scad> + +module mymodule() { + cylinder(r=RADIUS); +} diff --git a/testdata/modulecache-tests/multipleA.scad b/testdata/modulecache-tests/multipleA.scad new file mode 100644 index 0000000..5f22471 --- /dev/null +++ b/testdata/modulecache-tests/multipleA.scad @@ -0,0 +1,6 @@ +use <multiplecommon.scad> + +module A() +{ + sphere(r=F()); +} diff --git a/testdata/modulecache-tests/multipleB.scad b/testdata/modulecache-tests/multipleB.scad new file mode 100644 index 0000000..adee23c --- /dev/null +++ b/testdata/modulecache-tests/multipleB.scad @@ -0,0 +1,6 @@ +use <multiplecommon.scad> + +module B() +{ + cube(1.5*F(), center=true); +} diff --git a/testdata/modulecache-tests/multiplecommon.scad b/testdata/modulecache-tests/multiplecommon.scad new file mode 100644 index 0000000..666c99f --- /dev/null +++ b/testdata/modulecache-tests/multiplecommon.scad @@ -0,0 +1 @@ +function F() = 20; diff --git a/testdata/modulecache-tests/multiplemain.scad b/testdata/modulecache-tests/multiplemain.scad new file mode 100644 index 0000000..6dd75a7 --- /dev/null +++ b/testdata/modulecache-tests/multiplemain.scad @@ -0,0 +1,5 @@ +use <multipleA.scad> +use <multipleB.scad> + +A(); +translate([40,0,0]) B(); diff --git a/testdata/modulecache-tests/mymodule-lib.scad b/testdata/modulecache-tests/mymodule-lib.scad new file mode 100644 index 0000000..9d68581 --- /dev/null +++ b/testdata/modulecache-tests/mymodule-lib.scad @@ -0,0 +1,3 @@ +module mymodule() { + cylinder(center=true); +} diff --git a/testdata/modulecache-tests/radius.scad b/testdata/modulecache-tests/radius.scad new file mode 100644 index 0000000..7620356 --- /dev/null +++ b/testdata/modulecache-tests/radius.scad @@ -0,0 +1 @@ +RADIUS = 5; diff --git a/testdata/modulecache-tests/recursive.scad b/testdata/modulecache-tests/recursive.scad new file mode 100644 index 0000000..5c117f4 --- /dev/null +++ b/testdata/modulecache-tests/recursive.scad @@ -0,0 +1 @@ +use <recursive.scad> diff --git a/testdata/modulecache-tests/recursivemain.scad b/testdata/modulecache-tests/recursivemain.scad new file mode 100644 index 0000000..5c117f4 --- /dev/null +++ b/testdata/modulecache-tests/recursivemain.scad @@ -0,0 +1 @@ +use <recursive.scad> diff --git a/testdata/modulecache-tests/simpleinclude.scad b/testdata/modulecache-tests/simpleinclude.scad new file mode 100644 index 0000000..9a09502 --- /dev/null +++ b/testdata/modulecache-tests/simpleinclude.scad @@ -0,0 +1 @@ +include <simpleleaf.scad> diff --git a/testdata/modulecache-tests/simpleleaf.scad b/testdata/modulecache-tests/simpleleaf.scad new file mode 100644 index 0000000..b216b6c --- /dev/null +++ b/testdata/modulecache-tests/simpleleaf.scad @@ -0,0 +1 @@ +cylinder(h=25, r=12); diff --git a/testdata/modulecache-tests/use-mcad.scad b/testdata/modulecache-tests/use-mcad.scad new file mode 100644 index 0000000..b4b206a --- /dev/null +++ b/testdata/modulecache-tests/use-mcad.scad @@ -0,0 +1,3 @@ +use <MCAD/boxes.scad> + +roundedBox([10,10,10], 2, $fn=16); diff --git a/testdata/modulecache-tests/use.scad b/testdata/modulecache-tests/use.scad new file mode 100644 index 0000000..693092a --- /dev/null +++ b/testdata/modulecache-tests/use.scad @@ -0,0 +1,3 @@ +use <used.scad> + +used(s()); diff --git a/testdata/modulecache-tests/used.scad b/testdata/modulecache-tests/used.scad new file mode 100644 index 0000000..cc301b5 --- /dev/null +++ b/testdata/modulecache-tests/used.scad @@ -0,0 +1,5 @@ +function s() = 20; + +module used(r) { + sphere(r); +} diff --git a/testdata/modulecache-tests/usenonexistingfile.scad b/testdata/modulecache-tests/usenonexistingfile.scad new file mode 100644 index 0000000..b5e4dd9 --- /dev/null +++ b/testdata/modulecache-tests/usenonexistingfile.scad @@ -0,0 +1 @@ +use <nofile.scad> diff --git a/testdata/scad/bugs/issue204.scad b/testdata/scad/bugs/issue204.scad new file mode 100644 index 0000000..f2e8152 --- /dev/null +++ b/testdata/scad/bugs/issue204.scad @@ -0,0 +1,5 @@ +// Causes a CGAL assertion in CGALEvaluator::process() +e=0.000; +for (m = [ [ [ 0, 1, 0], [ 0, 0, 1], [ 1, 0, 0] ], + [ [-1, 0, e], [ 0,-1, 0], [ 0, 0,-1] ] ] ) + multmatrix (m) cube([1,5,1], center=true); diff --git a/testdata/scad/bugs/transform-nan-inf-tests.scad b/testdata/scad/bugs/transform-nan-inf-tests.scad new file mode 100644 index 0000000..cb8a667 --- /dev/null +++ b/testdata/scad/bugs/transform-nan-inf-tests.scad @@ -0,0 +1,12 @@ +// Test translation by NaN and Infinity +// cube()s should not be rendered + +// NaN +sphere(); +rotate([0, 0, asin(1.1) ]) cube(); + +// Infinity (as of 2012-08 this is detected as NaN) +translate([4,0,0]) { + sphere(); + rotate([0, 0, 1/0]) cube(); +} diff --git a/testdata/scad/features/background-modifier.scad b/testdata/scad/features/background-modifier.scad index ec7b28d..5430472 100644 --- a/testdata/scad/features/background-modifier.scad +++ b/testdata/scad/features/background-modifier.scad @@ -2,3 +2,4 @@ difference() { sphere(r=10); %cylinder(h=30, r=6, center=true); } +%if (true) cube([25,6,3], center=true); diff --git a/testdata/scad/features/control-hull-dimension.scad b/testdata/scad/features/control-hull-dimension.scad new file mode 100644 index 0000000..c8736db --- /dev/null +++ b/testdata/scad/features/control-hull-dimension.scad @@ -0,0 +1,4 @@ +hull() { + circle(1); + echo(1); +} diff --git a/testdata/scad/features/difference-tests.scad b/testdata/scad/features/difference-tests.scad index 3bcd9e5..b770764 100644 --- a/testdata/scad/features/difference-tests.scad +++ b/testdata/scad/features/difference-tests.scad @@ -28,3 +28,9 @@ translate([24,0,0]) difference() { cube([10,10,10], center=true); translate([0,0,6.99]) cylinder(r=4, h=4, center=true); } + +// Subtracting something from nothing +translate([24,12,0]) difference() { + cube([0,10,10], center=true); + # cylinder(r=4, h=20, center=true); +} diff --git a/testdata/scad/features/disable-modifier.scad b/testdata/scad/features/disable-modifier.scad index b47e074..2b75339 100644 --- a/testdata/scad/features/disable-modifier.scad +++ b/testdata/scad/features/disable-modifier.scad @@ -2,3 +2,4 @@ difference() { *sphere(r=10); cylinder(h=30, r=6, center=true); } +*if (true) cube([25,6,3], center=true); diff --git a/testdata/scad/features/highlight-and-background-modifier.scad b/testdata/scad/features/highlight-and-background-modifier.scad index 945d6b4..5dca703 100644 --- a/testdata/scad/features/highlight-and-background-modifier.scad +++ b/testdata/scad/features/highlight-and-background-modifier.scad @@ -1,8 +1,10 @@ difference() { sphere(r=10); %#cylinder(h=30, r=6, center=true); + %#if (true) cube([6,25,3], center=true); } translate([13,0,0]) difference() { sphere(r=10); #%cylinder(h=30, r=6, center=true); + #%if (true) cube([6,25,3], center=true); } diff --git a/testdata/scad/features/highlight-modifier.scad b/testdata/scad/features/highlight-modifier.scad index 1156a88..f228d08 100644 --- a/testdata/scad/features/highlight-modifier.scad +++ b/testdata/scad/features/highlight-modifier.scad @@ -2,3 +2,4 @@ difference() { sphere(r=10); #cylinder(h=30, r=6, center=true); } +#if (true) cube([25,6,3], center=true); diff --git a/testdata/scad/features/hull3-tests.scad b/testdata/scad/features/hull3-tests.scad index 12c8a11..e3fc8e7 100644 --- a/testdata/scad/features/hull3-tests.scad +++ b/testdata/scad/features/hull3-tests.scad @@ -15,3 +15,14 @@ translate([25,0,0]) hull() { cylinder(r=5, h=5, center=true); } } + +// Don't Crash (issue 188) + +translate([-5,-5,-5]) { + hull() { + intersection() { + cube([1,1,1]); + translate([-1,-1,-1]) cube([1,1,1]); + } + } +} diff --git a/testdata/scad/misc/recursion-tests.scad b/testdata/scad/misc/recursion-tests.scad new file mode 100644 index 0000000..2a07b91 --- /dev/null +++ b/testdata/scad/misc/recursion-tests.scad @@ -0,0 +1,2 @@ +function crash() = crash(); +echo(crash()); |