1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 22:28:16 +01:00
dotSCAD/test/util/test_dedup.scad

20 lines
558 B
OpenSCAD
Raw Normal View History

2021-02-08 10:02:28 +08:00
use <util/dedup.scad>;
module test_dedup() {
echo("==== test_dedup ====");
2021-02-08 10:53:18 +08:00
eq = function(e1, e2) e1[0] == e2[0] && e1[1] == e2[1] && e1[2] == e2[2];
2021-02-08 10:02:28 +08:00
points = [[1, 1, 2], [3, 4, 2], [7, 2, 2], [3, 4, 2], [1, 2, 3]];
assert(
dedup([[1, 1, 2], [3, 4, 2], [7, 2, 2], [3, 4, 2], [1, 2, 3]])
== [[1, 1, 2], [3, 4, 2], [7, 2, 2], [1, 2, 3]]
);
2021-02-08 10:53:18 +08:00
assert(
dedup([[1, 1, 2], [3, 4, 2], [7, 2, 2], [3, 4, 2], [1, 2, 3]], eq = eq)
== [[1, 1, 2], [3, 4, 2], [7, 2, 2], [1, 2, 3]]
);
2021-02-08 10:02:28 +08:00
}
test_dedup();