1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-03-29 18:32:30 +01:00
dotSCAD/test/util/test_sort.scad
2019-06-27 08:53:15 +08:00

24 lines
678 B
OpenSCAD

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();