1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-02-11 19:04:32 +01:00
dotSCAD/test/util/test_sort.scad

24 lines
662 B
OpenSCAD
Raw Normal View History

2020-01-26 16:54:09 +08:00
use <unittest.scad>;
use <util/sort.scad>;
2020-01-26 16:26:19 +08:00
2019-06-27 08:53:15 +08:00
module test_sort() {
echo("==== test_sort ====");
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();