1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-07 23:37:13 +02:00

refactor testcase

This commit is contained in:
Justin Lin
2020-01-27 15:10:29 +08:00
parent 62e8d2af84
commit 3ad03be311

View File

@@ -1,4 +1,5 @@
include <unittest.scad>; include <unittest.scad>;
include <line2d.scad>;
module test_line2d() { module test_line2d() {
$fn = 24; $fn = 24;
@@ -6,77 +7,24 @@ module test_line2d() {
p2 = [5, 0]; p2 = [5, 0];
width = 1; width = 1;
module test_line2d_cap_square() { echo("==== test_line2d_cap_square ====");
echo("==== test_line2d_cap_square ====");
include <line2d.scad>; module test_line2d_cap(point, style) {
assert(
module test_line2d_cap(point, style) { (point == p1 && style == "CAP_SQUARE") ||
assert( (point == p2 && style == "CAP_SQUARE")
(point == p1 && style == "CAP_SQUARE") || );
(point == p2 && style == "CAP_SQUARE")
);
}
module test_line2d_line(angle, length, width, frags) {
assertEqualNum(0, angle);
assertEqualNum(5, length);
assertEqualNum(1, width);
assertEqualNum(24, frags);
}
line2d(p1 = p1, p2 = p2, width = width);
} }
module test_line2d_cap_round() { module test_line2d_line(angle, length, width, frags) {
echo("==== test_line2d_cap_round ===="); assertEqualNum(0, angle);
assertEqualNum(5, length);
include <line2d.scad>; assertEqualNum(1, width);
assertEqualNum(24, frags);
module test_line2d_cap(point, style) { }
assert(
(point == p1 && style == "CAP_ROUND") || line2d(p1 = p1, p2 = p2, width = width);
(point == p2 && style == "CAP_ROUND")
);
}
module test_line2d_line(angle, length, width, frags) {
assertEqualNum(0, angle);
assertEqualNum(5, length);
assertEqualNum(1, width);
assertEqualNum(24, frags);
}
line2d(p1 = p1, p2 = p2, width = width,
p1Style = "CAP_ROUND", p2Style = "CAP_ROUND");
}
module test_line2d_cap_butt() {
echo("==== test_line2d_cap_butt ====");
include <line2d.scad>;
module test_line2d_cap(point, style) {
assert(
(point == p1 && style == "CAP_BUTT") ||
(point == p2 && style == "CAP_BUTT")
);
}
module test_line2d_line(angle, length, width, frags) {
assertEqualNum(0, angle);
assertEqualNum(5, length);
assertEqualNum(1, width);
assertEqualNum(24, frags);
}
line2d(p1 = p1, p2 = p2, width = width,
p1Style = "CAP_BUTT", p2Style = "CAP_BUTT");
}
test_line2d_cap_square();
test_line2d_cap_round();
test_line2d_cap_butt();
} }
test_line2d(); test_line2d();