diff options
Diffstat (limited to 'testdata')
-rw-r--r-- | testdata/scad/features/cylinder-tests.scad | 5 | ||||
-rw-r--r-- | testdata/scad/features/include-tests.scad | 4 | ||||
-rw-r--r-- | testdata/scad/features/intersection-tests.scad | 2 | ||||
-rw-r--r-- | testdata/scad/features/sub1/sub2/sub3/sub4/include-test2.scad | 4 | ||||
-rw-r--r-- | testdata/scad/features/sub1/sub2/sub3/sub4/use-test2.scad | 14 | ||||
-rw-r--r-- | testdata/scad/features/sub1/sub2/sub3/sub4/use-test3.scad | 4 | ||||
-rw-r--r-- | testdata/scad/features/sub1/sub2/sub3/use-test4.scad | 4 | ||||
-rw-r--r-- | testdata/scad/features/use test6.scad | 7 | ||||
-rw-r--r-- | testdata/scad/features/use-test5.scad | 4 | ||||
-rw-r--r-- | testdata/scad/features/use-tests.scad | 39 |
10 files changed, 83 insertions, 4 deletions
diff --git a/testdata/scad/features/cylinder-tests.scad b/testdata/scad/features/cylinder-tests.scad index 54e88cd..71f43a6 100644 --- a/testdata/scad/features/cylinder-tests.scad +++ b/testdata/scad/features/cylinder-tests.scad @@ -12,4 +12,9 @@ translate([22,-11,0]) cylinder(h=5, r=5, r1=0, center=true); translate([22,0,0]) cylinder(h=5, r=5, r2=0); translate([22,11,0]) cylinder(h=15, r=5, r2=5); +// This tests for hexagonal cylinder orientation, since people +// tend to "abuse" this for captured nut slots +translate([-10,0,0]) cylinder(h=2, r=3, $fn=6); + + // FIXME: We could test $fs, $fa, $fn as well diff --git a/testdata/scad/features/include-tests.scad b/testdata/scad/features/include-tests.scad index 36c04ca..fc4e9d0 100644 --- a/testdata/scad/features/include-tests.scad +++ b/testdata/scad/features/include-tests.scad @@ -7,7 +7,7 @@ include <non/existent/path/non-file> //Test with empty path include <include-test5.scad> -//Test without preceeding space +//Test without preceding space include<include-test5.scad> //Test with other strange character that is allowed @@ -34,7 +34,7 @@ module test1() translate([-2,-2,0]) test6(); //Just to give a top level object - translate([0,-2,0]) sphere(0.7, $fn=16); + translate([0,-2,0]) sphere(test2_variable, $fn=16); } test1(); diff --git a/testdata/scad/features/intersection-tests.scad b/testdata/scad/features/intersection-tests.scad index e53f3c9..4a1d7e3 100644 --- a/testdata/scad/features/intersection-tests.scad +++ b/testdata/scad/features/intersection-tests.scad @@ -22,7 +22,7 @@ translate([12,0,0]) intersection() { translate([12,12,0]) intersection() { cube([10,10,10], center=true); - translate([0,0,7]) cylinder(r=4, h=4, center=true); + translate([0,0,7.01]) cylinder(r=4, h=4, center=true); } translate([24,0,0]) intersection() { diff --git a/testdata/scad/features/sub1/sub2/sub3/sub4/include-test2.scad b/testdata/scad/features/sub1/sub2/sub3/sub4/include-test2.scad index 140c4ed..c34632c 100644 --- a/testdata/scad/features/sub1/sub2/sub3/sub4/include-test2.scad +++ b/testdata/scad/features/sub1/sub2/sub3/sub4/include-test2.scad @@ -4,7 +4,9 @@ include <include-test3.scad> //Test relative file location include <../include-test4.scad> -module test2 () +test2_variable = 0.7; + +module test2() { cube(center=true); } diff --git a/testdata/scad/features/sub1/sub2/sub3/sub4/use-test2.scad b/testdata/scad/features/sub1/sub2/sub3/sub4/use-test2.scad new file mode 100644 index 0000000..68013db --- /dev/null +++ b/testdata/scad/features/sub1/sub2/sub3/sub4/use-test2.scad @@ -0,0 +1,14 @@ +//Test nested use +use <use-test3.scad> + +//Test relative file location +use <../use-test4.scad> + +test2_variable = 0.7; + +module test2() +{ + translate([2,0,0]) test3(); + translate([2,-2,0]) test4(); + cube(center=true); +} diff --git a/testdata/scad/features/sub1/sub2/sub3/sub4/use-test3.scad b/testdata/scad/features/sub1/sub2/sub3/sub4/use-test3.scad new file mode 100644 index 0000000..6e3537e --- /dev/null +++ b/testdata/scad/features/sub1/sub2/sub3/sub4/use-test3.scad @@ -0,0 +1,4 @@ +module test3() +{ + cylinder(r1=0.7, r2=0.2, center=true); +} diff --git a/testdata/scad/features/sub1/sub2/sub3/use-test4.scad b/testdata/scad/features/sub1/sub2/sub3/use-test4.scad new file mode 100644 index 0000000..c13368c --- /dev/null +++ b/testdata/scad/features/sub1/sub2/sub3/use-test4.scad @@ -0,0 +1,4 @@ +module test4() +{ + cylinder(r=0.5, $fn=10, center=true); +} diff --git a/testdata/scad/features/use test6.scad b/testdata/scad/features/use test6.scad new file mode 100644 index 0000000..0d96b26 --- /dev/null +++ b/testdata/scad/features/use test6.scad @@ -0,0 +1,7 @@ +module test6() +{ + difference() { + cube(center=true); + cylinder(r=0.4, h=2, center=true); + } +} diff --git a/testdata/scad/features/use-test5.scad b/testdata/scad/features/use-test5.scad new file mode 100644 index 0000000..e4393cb --- /dev/null +++ b/testdata/scad/features/use-test5.scad @@ -0,0 +1,4 @@ +module test5() +{ + sphere(r=0.5, $fn=8); +} diff --git a/testdata/scad/features/use-tests.scad b/testdata/scad/features/use-tests.scad new file mode 100644 index 0000000..64af692 --- /dev/null +++ b/testdata/scad/features/use-tests.scad @@ -0,0 +1,39 @@ +//Test that the entire path is pushed onto the stack upto the last '/' +use <sub1/sub2/sub3/sub4/use-test2.scad> + +//Test that a non existent path/file doesn't screw things up +use <non/existent/path/non-file> + +//Test with empty path +use <use-test5.scad> + +//Test without preceding space +use<use-test5.scad> + +//Test with other strange character that is allowed +use>>>>><use-test5.scad> + +//Test that filenames with spaces work +use <use test6.scad> + +//Test with empty file +use<test/> + +//Test with empty path and file +use </> + +module test1() +{ + test2(); + // test3() and test4() are not directly included and thus not imported into + // this scope + translate([4,0,0]) test3(); + translate([4,-2,0]) test4(); + translate([-2,0,0]) test5(); + translate([-2,-2,0]) test6(); + + // test2_variable won't be visible + translate([0,-2,0]) sphere(test2_variable, $fn=16); +} + +test1(); |