2022-06-06 13:11:46 +08:00
|
|
|
use <unittest.scad>
|
|
|
|
include <line2d.scad>
|
2020-01-28 09:44:36 +08:00
|
|
|
|
|
|
|
module test_line2d_cap(point, style) {
|
|
|
|
p1 = [0, 0];
|
|
|
|
p2 = [5, 0];
|
|
|
|
assert(
|
|
|
|
(point == p1 && style == "CAP_SQUARE") ||
|
|
|
|
(point == p2 && style == "CAP_SQUARE")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-04-16 11:34:21 +08:00
|
|
|
module test_line2d_line(length, width, frags) {
|
2020-01-28 09:44:36 +08:00
|
|
|
assertEqualNum(5, length);
|
|
|
|
assertEqualNum(1, width);
|
|
|
|
assertEqualNum(24, frags);
|
|
|
|
}
|
2017-05-26 10:20:32 +08:00
|
|
|
|
2017-05-26 10:22:23 +08:00
|
|
|
module test_line2d() {
|
2017-05-26 10:20:32 +08:00
|
|
|
$fn = 24;
|
|
|
|
p1 = [0, 0];
|
|
|
|
p2 = [5, 0];
|
|
|
|
width = 1;
|
2017-05-26 10:22:23 +08:00
|
|
|
|
2020-01-28 09:44:36 +08:00
|
|
|
echo("==== test_line2d_cap_square ====");
|
2020-01-27 15:10:29 +08:00
|
|
|
|
|
|
|
line2d(p1 = p1, p2 = p2, width = width);
|
2017-05-26 10:20:32 +08:00
|
|
|
}
|
|
|
|
|
2017-05-26 10:22:23 +08:00
|
|
|
test_line2d();
|
|
|
|
|