mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 14:18:13 +01:00
28 lines
601 B
OpenSCAD
28 lines
601 B
OpenSCAD
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(); |