mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-23 14:54:12 +02:00
rename
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
function hashmap_list(map) = [
|
||||
function hashmap_entries(map) = [
|
||||
for(bucket = map)
|
||||
for(kv = bucket)
|
||||
kv
|
@@ -1,5 +1,5 @@
|
||||
use <util/map/hashmap.scad>;
|
||||
use <util/map/hashmap_list.scad>;
|
||||
use <util/map/hashmap_entries.scad>;
|
||||
use <util/map/hashmap_put.scad>;
|
||||
use <util/map/hashmap_len.scad>;
|
||||
use <util/map/hashmap_del.scad>;
|
||||
@@ -17,17 +17,17 @@ module test_hashmap() {
|
||||
|
||||
assert(hashmap_len(s) == 4);
|
||||
|
||||
assert(hashmap_list(s) == [["k9876", 3], ["k4444", 3], ["k1234", 1], ["k5678", 2]]);
|
||||
assert(hashmap_entries(s) == [["k9876", 3], ["k4444", 3], ["k1234", 1], ["k5678", 2]]);
|
||||
|
||||
s2 = hashmap_put(s, "k1357", 100);
|
||||
assert(hashmap_list(s2) == [["k9876", 3], ["k4444", 3], ["k1234", 1], ["k5678", 2], ["k1357", 100]]);
|
||||
assert(hashmap_entries(s2) == [["k9876", 3], ["k4444", 3], ["k1234", 1], ["k5678", 2], ["k1357", 100]]);
|
||||
|
||||
s3 = hashmap_put(s2, "k5678", 200);
|
||||
assert(hashmap_list(s3) == [["k9876", 3], ["k4444", 3], ["k1234", 1], ["k5678", 200], ["k1357", 100]]);
|
||||
assert(hashmap_entries(s3) == [["k9876", 3], ["k4444", 3], ["k1234", 1], ["k5678", 200], ["k1357", 100]]);
|
||||
|
||||
s4 = hashmap_del(s3, "k4444");
|
||||
assert(hashmap_list(s4) == [["k9876", 3], ["k1234", 1], ["k5678", 200], ["k1357", 100]]);
|
||||
assert(hashmap_list(hashmap_del(s4, "k4444")) == [["k9876", 3], ["k1234", 1], ["k5678", 200], ["k1357", 100]]);
|
||||
assert(hashmap_entries(s4) == [["k9876", 3], ["k1234", 1], ["k5678", 200], ["k1357", 100]]);
|
||||
assert(hashmap_entries(hashmap_del(s4, "k4444")) == [["k9876", 3], ["k1234", 1], ["k5678", 200], ["k1357", 100]]);
|
||||
|
||||
assert(hashmap_get(s4, "k1234") == 1);
|
||||
assert(hashmap_get(s4, "k0000") == undef);
|
||||
|
Reference in New Issue
Block a user