mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-04-20 06:02:05 +02:00
add test
This commit is contained in:
parent
f82cd92d9e
commit
6516f7206c
@ -44,7 +44,7 @@ function hashset_del(set, elem, hash = df_hash, eq = df_eq) =
|
||||
leng = len(bucket)
|
||||
)
|
||||
leng == 0 ? set :
|
||||
let(i = _find(bucket, elem, eq, leng), _ = echo(i))
|
||||
let(i = _find(bucket, elem, eq, leng))
|
||||
i == -1 ? set :
|
||||
concat(
|
||||
slice(set, 0, bidx),
|
||||
|
18
test/collection/test_hashset.scad
Normal file
18
test/collection/test_hashset.scad
Normal file
@ -0,0 +1,18 @@
|
||||
use <unittest.scad>;
|
||||
use <collection/hashset.scad>;
|
||||
|
||||
module test_hashset() {
|
||||
echo("==== test_hashset ====");
|
||||
|
||||
s = hashset([1, 2, 3, 4, 5, 2, 3, 5]);
|
||||
assert(hashset_list(s) == [1, 2, 3, 4, 5]);
|
||||
|
||||
s2 = hashset_add(s, 9);
|
||||
assert(hashset_list(s2) == [1, 2, 3, 4, 5, 9]);
|
||||
|
||||
assert(!hashset_has(s2, 13));
|
||||
|
||||
assert(hashset_list(hashset_del(s2, 2)) == [1, 3, 4, 5, 9]);
|
||||
}
|
||||
|
||||
test_hashset();
|
Loading…
x
Reference in New Issue
Block a user