test reorganization

This commit is contained in:
Adrian Mariano
2021-09-16 17:07:12 -04:00
parent 5d0b42b667
commit 32d9a96bc4
5 changed files with 123 additions and 67 deletions

View File

@@ -12,7 +12,7 @@ test_point_line_distance();
test_segment_distance();
test_line_normal();
test_line_intersection();
//test_line_ray_intersection(); // should add this typ eof case
//test_line_ray_intersection(); // should add this type of case
//test_ray_intersection(); // should add this type of case
//test_ray_segment_intersection(); // should add this type of case
test_line_closest_point();
@@ -56,13 +56,6 @@ test_reverse_polygon();
test_polygon_normal();
//tests to migrate to other files
test_is_path();
test_is_closed_path();
test_close_path();
test_cleanup_path();
test_simplify_path();
test_simplify_path_indexed();
test_is_region();
test_convex_distance();
test_convex_collision();
@@ -751,40 +744,6 @@ module test_is_above_plane() {
*test_is_above_plane();
module test_is_path() {
assert(is_path([[1,2,3],[4,5,6]]));
assert(is_path([[1,2,3],[4,5,6],[7,8,9]]));
assert(!is_path(123));
assert(!is_path("foo"));
assert(!is_path(true));
assert(!is_path([]));
assert(!is_path([[]]));
assert(!is_path([["foo","bar","baz"]]));
assert(!is_path([[1,2,3]]));
assert(!is_path([["foo","bar","baz"],["qux","quux","quuux"]]));
}
*test_is_path();
module test_is_closed_path() {
assert(!is_closed_path([[1,2,3],[4,5,6],[1,8,9]]));
assert(is_closed_path([[1,2,3],[4,5,6],[1,8,9],[1,2,3]]));
}
*test_is_closed_path();
module test_close_path() {
assert(close_path([[1,2,3],[4,5,6],[1,8,9]]) == [[1,2,3],[4,5,6],[1,8,9],[1,2,3]]);
assert(close_path([[1,2,3],[4,5,6],[1,8,9],[1,2,3]]) == [[1,2,3],[4,5,6],[1,8,9],[1,2,3]]);
}
*test_close_path();
module test_cleanup_path() {
assert(cleanup_path([[1,2,3],[4,5,6],[1,8,9]]) == [[1,2,3],[4,5,6],[1,8,9]]);
assert(cleanup_path([[1,2,3],[4,5,6],[1,8,9],[1,2,3]]) == [[1,2,3],[4,5,6],[1,8,9]]);
}
*test_cleanup_path();
module test_polygon_area() {
@@ -869,19 +828,6 @@ module test_centroid() {
*test_centroid();
module test_simplify_path() {
path = [[-20,-20], [-10,-20], [0,-10], [10,0], [20,10], [20,20], [15,30]];
assert(simplify_path(path) == [[-20,-20], [-10,-20], [20,10], [20,20], [15,30]]);
}
*test_simplify_path();
module test_simplify_path_indexed() {
pts = [[10,0], [0,-10], [20,20], [20,10], [-20,-20], [15,30], [-10,-20]];
path = [4,6,1,0,3,2,5];
assert(simplify_path_indexed(pts, path) == [4,6,3,2,5]);
}
*test_simplify_path_indexed();
module test_point_in_polygon() {
@@ -946,17 +892,6 @@ module test_reverse_polygon() {
*test_reverse_polygon();
module test_is_region() {
assert(is_region([circle(d=10),square(10)]));
assert(is_region([circle(d=10),square(10),circle(d=50)]));
assert(is_region([square(10)]));
assert(!is_region([]));
assert(!is_region(23));
assert(!is_region(true));
assert(!is_region("foo"));
}
*test_is_region();
module test_convex_distance() {
// 2D
c1 = circle(10,$fn=24);