Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
use <util/flat.scad>
module test_flat() {
echo("==== test_flat ====");
vt = [[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]];
assert(
flat([1, 2, [3, 4]]) == [1, 2, 3, 4]
);
assert(
flat([[1, 2], [3, 4]]) == [1, 2, 3, 4]
);
assert(
flat([[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]]) == [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
);
assert(
flat([[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]], 2) == [[1, 2], [3, 4], [5, 6], [7, 8]]
);
assert(
flat([[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]], 3) == [1, 2, 3, 4, 5, 6, 7, 8]
);
}
test_flat();bb33edfd7This file is pinned to the selected release. Download the original to open it in your design tool.