From ea8ca50e2a69da4a8c6b796be48b79a3e1cd5500 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 26 May 2017 10:22:23 +0800 Subject: [PATCH] updated testcase --- test/test_line2d.scad | 148 ++++++++++++++++++++---------------------- 1 file changed, 70 insertions(+), 78 deletions(-) diff --git a/test/test_line2d.scad b/test/test_line2d.scad index 49a71efc..2b479e49 100644 --- a/test/test_line2d.scad +++ b/test/test_line2d.scad @@ -1,91 +1,83 @@ include ; -module test_line2d_cap_square() { - echo("==== test_line2d_cap_square ===="); - +module test_line2d() { $fn = 24; - p1 = [0, 0]; p2 = [5, 0]; width = 1; - - include ; - - module cap(point, style) { - assertTrue( - (point == p1 && style == "CAP_SQUARE") || - (point == p2 && style == "CAP_SQUARE") - ); + + module test_line2d_cap_square() { + echo("==== test_line2d_cap_square ===="); + + include ; + + module cap(point, style) { + assertTrue( + (point == p1 && style == "CAP_SQUARE") || + (point == p2 && style == "CAP_SQUARE") + ); + } + + module test_line2d_line(angle, length, width, frags) { + assertEqual(0, angle); + assertEqual(5, length); + assertEqual(1, width); + assertEqual(24, frags); + } + + line2d(p1 = p1, p2 = p2, width = width); } - - module test_line2d_line(angle, length, width, frags) { - assertEqual(0, angle); - assertEqual(5, length); - assertEqual(1, width); - assertEqual(24, frags); - } - - line2d(p1 = p1, p2 = p2, width = width); -} -module test_line2d_cap_round() { - echo("==== test_line2d_cap_round ===="); + module test_line2d_cap_round() { + echo("==== test_line2d_cap_round ===="); - $fn = 24; + include ; - p1 = [0, 0]; - p2 = [5, 0]; - width = 1; - - include ; - - module cap(point, style) { - assertTrue( - (point == p1 && style == "CAP_ROUND") || - (point == p2 && style == "CAP_ROUND") - ); - } - - module test_line2d_line(angle, length, width, frags) { - assertEqual(0, angle); - assertEqual(5, length); - assertEqual(1, width); - assertEqual(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 ===="); - - $fn = 24; + module cap(point, style) { + assertTrue( + (point == p1 && style == "CAP_ROUND") || + (point == p2 && style == "CAP_ROUND") + ); + } - p1 = [0, 0]; - p2 = [5, 0]; - width = 1; - - include ; - - module cap(point, style) { - assertTrue( - (point == p1 && style == "CAP_BUTT") || - (point == p2 && style == "CAP_BUTT") - ); - } - - module test_line2d_line(angle, length, width, frags) { - assertEqual(0, angle); - assertEqual(5, length); - assertEqual(1, width); - assertEqual(24, frags); - } - - line2d(p1 = p1, p2 = p2, width = width, - p1Style = "CAP_BUTT", p2Style = "CAP_BUTT"); + module test_line2d_line(angle, length, width, frags) { + assertEqual(0, angle); + assertEqual(5, length); + assertEqual(1, width); + assertEqual(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 ; + + module cap(point, style) { + assertTrue( + (point == p1 && style == "CAP_BUTT") || + (point == p2 && style == "CAP_BUTT") + ); + } + + module test_line2d_line(angle, length, width, frags) { + assertEqual(0, angle); + assertEqual(5, length); + assertEqual(1, width); + assertEqual(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_cap_square(); -test_line2d_cap_round(); -test_line2d_cap_butt(); \ No newline at end of file +test_line2d(); +