1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-03-14 11:10:01 +01:00
This commit is contained in:
Justin Lin 2021-02-26 12:11:25 +08:00
parent 44733e7a9a
commit 5244a6ea95
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,3 @@
function _every(lt, test, leng, i = 0) =
i == leng ? true :
test(lt[i]) ? _every(lt, test, leng, i + 1) : false;
!test(lt[i]) ? false : _every(lt, test, leng, i + 1);

10
test/util/test_every.scad Normal file
View File

@ -0,0 +1,10 @@
use <util/every.scad>;
module test_every() {
echo("==== test_every ====");
assert(every([1, 2, 3, 4, 5], function(elem) elem > 0));
assert(every([1, 2, 3, 4, 5], function(elem) elem > 3));
}
test_every();