mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 06:08:31 +01:00
use built-in assert
This commit is contained in:
parent
37e272e333
commit
df0f293825
@ -96,15 +96,6 @@ module assertEqual(expected, actual, float_digits = 4) {
|
||||
}
|
||||
}
|
||||
|
||||
module assertTrue(truth) {
|
||||
if(!truth) {
|
||||
fail(
|
||||
"Truth",
|
||||
"expected: true, but: false"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module round_echo_pts(points, float_digits = 4) {
|
||||
echo(round_pts(points, float_digits));
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ module test_function_grapher_default() {
|
||||
expected_faces = [[0, 5, 1], [1, 6, 2], [2, 7, 3], [4, 9, 5], [5, 10, 6], [6, 11, 7], [8, 13, 9], [9, 14, 10], [10, 15, 11], [0, 4, 5], [1, 5, 6], [2, 6, 7], [4, 8, 9], [5, 9, 10], [6, 10, 11], [8, 12, 13], [9, 13, 14], [10, 14, 15], [17, 21, 16], [18, 22, 17], [19, 23, 18], [21, 25, 20], [22, 26, 21], [23, 27, 22], [25, 29, 24], [26, 30, 25], [27, 31, 26], [21, 20, 16], [22, 21, 17], [23, 22, 18], [25, 24, 20], [26, 25, 21], [27, 26, 22], [29, 28, 24], [30, 29, 25], [31, 30, 26], [0, 1, 17, 16], [1, 2, 18, 17], [2, 3, 19, 18], [3, 7, 23, 19], [7, 11, 27, 23], [11, 15, 31, 27], [13, 12, 28, 29], [14, 13, 29, 30], [15, 14, 30, 31], [4, 0, 16, 20], [8, 4, 20, 24], [12, 8, 24, 28]];
|
||||
|
||||
for(i = [0:len(expected_faces) - 1]) {
|
||||
assertTrue(expected_faces[i] == faces[i]);
|
||||
assert(expected_faces[i] == faces[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ module test_line2d() {
|
||||
include <line2d.scad>;
|
||||
|
||||
module test_line2d_cap(point, style) {
|
||||
assertTrue(
|
||||
assert(
|
||||
(point == p1 && style == "CAP_SQUARE") ||
|
||||
(point == p2 && style == "CAP_SQUARE")
|
||||
);
|
||||
@ -34,7 +34,7 @@ module test_line2d() {
|
||||
include <line2d.scad>;
|
||||
|
||||
module test_line2d_cap(point, style) {
|
||||
assertTrue(
|
||||
assert(
|
||||
(point == p1 && style == "CAP_ROUND") ||
|
||||
(point == p2 && style == "CAP_ROUND")
|
||||
);
|
||||
@ -57,7 +57,7 @@ module test_line2d() {
|
||||
include <line2d.scad>;
|
||||
|
||||
module test_line2d_cap(point, style) {
|
||||
assertTrue(
|
||||
assert(
|
||||
(point == p1 && style == "CAP_BUTT") ||
|
||||
(point == p2 && style == "CAP_BUTT")
|
||||
);
|
||||
|
@ -20,7 +20,7 @@ module test_line3d() {
|
||||
}
|
||||
|
||||
module test_line3d_cap(p, r, frags, cap_leng, angles) {
|
||||
assertTrue(p == p1 || p == p2);
|
||||
assert(p == p1 || p == p2);
|
||||
assertEqual(thickness / 2, r);
|
||||
assertEqual(fn, frags);
|
||||
assertEqual(0.3536, cap_leng);
|
||||
@ -77,7 +77,7 @@ module test_line3d() {
|
||||
}
|
||||
|
||||
module test_line3d_cap(p, r, frags, cap_leng, angles) {
|
||||
assertTrue(p == p1 || p == p2);
|
||||
assert(p == p1 || p == p2);
|
||||
assertEqual(thickness / 2, r);
|
||||
assertEqual(fn, frags);
|
||||
assertEqual(0.5043, cap_leng);
|
||||
|
@ -35,7 +35,7 @@ module test_polysections_solid_sections() {
|
||||
assertEqualPoints(expected_pts, points);
|
||||
|
||||
for(i = [0:len(expected_faces) - 1]) {
|
||||
assertTrue(expected_faces[i] == faces[i]);
|
||||
assert(expected_faces[i] == faces[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ module test_polysections_hollow_sections() {
|
||||
assertEqualPoints(expected_pts, points);
|
||||
|
||||
for(i = [0:len(expected_faces) - 1]) {
|
||||
assertTrue(expected_faces[i] == faces[i]);
|
||||
assert(expected_faces[i] == faces[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ module test_rounded_cube_size_corner() {
|
||||
module test_rounded_edge_corner_center(corner_frags, corners, center_pts) {
|
||||
half_size = size / 2;
|
||||
|
||||
assertTrue(corner_frags % 4 == 0);
|
||||
assert(corner_frags % 4 == 0);
|
||||
|
||||
expected_corners = [[5.0961, 5.0961, 5.0961], [-5.0961, 5.0961, 5.0961], [5.0961, -5.0961, 5.0961], [-5.0961, -5.0961, 5.0961], [5.0961, 5.0961, -5.0961], [-5.0961, 5.0961, -5.0961], [5.0961, -5.0961, -5.0961], [-5.0961, -5.0961, -5.0961]];
|
||||
|
||||
@ -36,7 +36,7 @@ module test_rounded_cube_size_center() {
|
||||
|
||||
module test_rounded_edge_corner_center(corner_frags, corners, center_pts) {
|
||||
|
||||
assertTrue(corner_frags % 4 == 0);
|
||||
assert(corner_frags % 4 == 0);
|
||||
|
||||
expected_corners = [[20.0961, 7.5961, 2.5961], [-20.0961, 7.5961, 2.5961], [20.0961, -7.5961, 2.5961], [-20.0961, -7.5961, 2.5961], [20.0961, 7.5961, -2.5961], [-20.0961, 7.5961, -2.5961], [20.0961, -7.5961, -2.5961], [-20.0961, -7.5961, -2.5961]];
|
||||
|
||||
@ -63,7 +63,7 @@ module test_rounded_cube_size_center_fn() {
|
||||
|
||||
module test_rounded_edge_corner_center(corner_frags, corners, center_pts) {
|
||||
|
||||
assertTrue(corner_frags == $fn);
|
||||
assert(corner_frags == $fn);
|
||||
|
||||
expected_corners = [[20.3806, 7.8806, 2.8806], [-20.3806, 7.8806, 2.8806], [20.3806, -7.8806, 2.8806], [-20.3806, -7.8806, 2.8806], [20.3806, 7.8806, -2.8806], [-20.3806, 7.8806, -2.8806], [20.3806, -7.8806, -2.8806], [-20.3806, -7.8806, -2.8806]];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user