mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-07-31 03:50:27 +02:00
support key param
This commit is contained in:
@@ -21,6 +21,11 @@ module test_sorted() {
|
||||
descending = function(e1, e2) e2 - e1;
|
||||
assert(sorted([2, 1, 3, 5, 4], ascending) == [1, 2, 3, 4, 5]);
|
||||
assert(sorted([2, 1, 3, 5, 4], descending) == [5, 4, 3, 2, 1]);
|
||||
|
||||
assert(
|
||||
[[2, 0, 0], [5, 0, 0], [7, 0, 0], [9, 0, 0], [10, 0, 0]] ==
|
||||
sorted([[10, 0, 0], [5, 0, 0], [7, 0, 0], [2, 0, 0], [9, 0, 0]], key = function(elem) elem.x)
|
||||
);
|
||||
}
|
||||
|
||||
test_sorted();
|
||||
|
Reference in New Issue
Block a user