Testing improvements and cleanup

This commit is contained in:
Elmom 2010-08-26 14:19:49 +03:00
parent 35914eb5ea
commit 83ed86cfaa
4 changed files with 13 additions and 35 deletions

View file

@ -1,5 +1,5 @@
// Parametric screw-like things (ball screws, augers) // Parametric screw-like things (ball screws, augers)
// License: GNU GPL 2.0 or later. // License: GNU LGPL 2.1 or later.
// © 2010 by Elmo Mäntynen // © 2010 by Elmo Mäntynen
include <curves.scad> include <curves.scad>

View file

@ -104,5 +104,5 @@ module alignds420(position, rotation, screws = 0, axle_lenght = 0)
} }
} }
// Example, uncomment to test // Tests:
alignds420(screws=1); module test_alignds420(){alignds420(screws=1);}

View file

@ -16,14 +16,14 @@ def pytest_generate_tests(metafunc):
metafunc.addcall(funcargs=dict(modpath=fpath)) metafunc.addcall(funcargs=dict(modpath=fpath))
def test_compile(modname, modpath): def test_module_compile(modname, modpath):
tempname = "test_" + modpath.basename + modname + '.scad' tempname = modpath.basename + '-' + modname + '.scad'
fpath = temppath.join(tempname) fpath = temppath.join(tempname)
stlpath = temppath.join(tempname + ".stl") stlpath = temppath.join(tempname + ".stl")
f = fpath.open('w') f = fpath.open('w')
f.write(""" f.write("""
//generated testfile //generated testfile
include <%s> use <%s>
%s(); %s();
""" % (modpath, modname)) """ % (modpath, modname))
@ -34,9 +34,8 @@ include <%s>
assert "warning" or "error" not in output[2].strip().lowercase() assert "warning" or "error" not in output[2].strip().lowercase()
assert len(stlpath.readlines()) > 2 assert len(stlpath.readlines()) > 2
def test_compile_default(modpath): def test_file_compile(modpath):
tempname = "test_" + modpath.basename stlpath = temppath.join(modpath.basename + "-test.stl")
stlpath = temppath.join(tempname + ".stl")
output = call_openscad(path=modpath, stlpath=stlpath) output = call_openscad(path=modpath, stlpath=stlpath)
print output print output
assert output[0] is 0 assert output[0] is 0

View file

@ -23,27 +23,6 @@ function angle(v) = angleOfNormalizedVector(normalized(v));
function angleBetweenTwoPoints(a, b) = angle(normalized(b-a)); function angleBetweenTwoPoints(a, b) = angle(normalized(b-a));
// Untested
module intersection(big_number=1000000000){
difference(){
child(0);
difference(){
cube(big_number, center=true);
child(1);
}
}
}
module intersection2(){
difference(){
child(0);
difference(){
child(0);
child(1);
}
}
}
CENTER = 0; CENTER = 0;
LEFT = -0.5; LEFT = -0.5;