1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-12 01:34:12 +02:00
This commit is contained in:
Justin Lin
2019-06-27 08:53:15 +08:00
parent aa5fc938d0
commit fd684a10cb
4 changed files with 44 additions and 0 deletions

23
test/util/test_sort.scad Normal file
View File

@@ -0,0 +1,23 @@
module test_sort() {
echo("==== test_sort ====");
include <unittest.scad>;
include <util/sort.scad>;
assertEqualPoints(
[[2, 0, 0], [5, 0, 0], [7, 0, 0], [9, 0, 0], [10, 0, 0]],
sort([[10, 0, 0], [5, 0, 0], [7, 0, 0], [2, 0, 0], [9, 0, 0]], by = "x")
);
assertEqualPoints(
[[2, 0, 0], [5, 0, 0], [7, 0, 0], [9, 0, 0], [10, 0, 0]],
sort([[10, 0, 0], [5, 0, 0], [7, 0, 0], [2, 0, 0], [9, 0, 0]], by = "idx", idx = 0)
);
assertEqualPoints(
[[0, 2, 0], [0, 5, 0], [0, 7, 0], [0, 9, 0], [0, 10, 0]],
sort([[0, 10, 0], [0, 5, 0], [0, 7, 0], [0, 2, 0], [0, 9, 0]], by = "y")
);
}
test_sort();