1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 18:24:28 +02:00

add test case

This commit is contained in:
Justin Lin
2019-06-17 07:36:17 +08:00
parent ed9477ece5
commit 9182575ff2
3 changed files with 65 additions and 0 deletions

View File

@@ -135,6 +135,7 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
rotate(twist_step_a * i)
scale([1, 1, 1] + scale_step_vt * i)
children(0);
test_along_with_angles(angs);
}
// <<< end: modules and functions for "EULER-ANGLE"
@@ -192,4 +193,8 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
}
}
}
module test_along_with_angles(angles) {
}

View File

@@ -17,6 +17,7 @@ include <test_polysections.scad>;
// Transformation
include <test_bend.scad>;
include <test_along_with.scad>;
// Function
include <test_rotate_p.scad>;

59
test/test_along_with.scad Normal file
View File

@@ -0,0 +1,59 @@
include <unittest.scad>;
module test_along_with_default_angles() {
echo("==== test_along_with_default_angles ====");
include <along_with.scad>;
include <m_rotation.scad>;
include <circle_path.scad>;
$fn = 24;
points = circle_path(radius = 50);
module test_along_with_angles(angles) {
expected_angles = [[0, 0, 97.5], [0, 0, 97.5], [0, 0, 112.5], [0, 0, 127.5], [0, 0, 142.5], [0, 0, 157.5], [0, 0, 172.5], [0, 0, -172.5], [0, 0, -157.5], [0, 0, -142.5], [0, 0, -127.5], [0, 0, -112.5], [0, 0, -97.5], [0, 0, -82.5], [0, 0, -67.5], [0, 0, -52.5], [0, 0, -37.5], [0, 0, -22.5], [0, 0, -7.5], [0, 0, 7.5], [0, 0, 22.5], [0, 0, 37.5], [0, 0, 52.5], [0, 0, 67.5]];
assert($fn == len(angles));
assertEqualPoints(expected_angles, angles);
}
along_with(points)
sphere(5);
}
module test_along_with_children() {
echo("==== test_along_with_children ====");
include <along_with.scad>;
include <m_rotation.scad>;
include <circle_path.scad>;
$fn = 24;
points = circle_path(radius = 50);
module test_along_with_angles(angles) {
expected_angles = [[0, 0, 97.5], [0, 0, 97.5], [0, 0, 112.5], [0, 0, 127.5], [0, 0, 142.5], [0, 0, 157.5], [0, 0, 172.5], [0, 0, -172.5]];
assertEqual(8, len(angles));
assertEqualPoints(expected_angles, angles);
}
along_with(points) {
linear_extrude(10, center = true) text("A", valign = "center", halign = "center");
linear_extrude(5, center = true) circle(2);
sphere(1);
cube(5);
linear_extrude(10, center = true) text("A", valign = "center", halign = "center");
linear_extrude(5, center = true) circle(2);
sphere(1);
cube(5);
}
}
test_along_with_default_angles();
test_along_with_children();