mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-24 07:38:46 +00:00
Hash table
This commit is contained in:
parent
46dfd58bda
commit
149984f5c0
14 changed files with 258 additions and 21 deletions
26
stdlib/regression/test07.expr
Normal file
26
stdlib/regression/test07.expr
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import Collection;
|
||||
|
||||
local a = {1, 2, 3}, b = {1, 2, 3}, t = emptyHashTab ();
|
||||
|
||||
t := addHashTab (t, a, 100);
|
||||
validateColl ();
|
||||
printf ("HashTab internal structure: %s\n", t.string);
|
||||
|
||||
t := addHashTab (t, b, 200);
|
||||
validateColl ();
|
||||
printf ("HashTab internal structure: %s\n", t.string);
|
||||
|
||||
printf ("Searching: %s\n", findHashTab (t, a).string);
|
||||
printf ("Searching: %s\n", findHashTab (t, b).string);
|
||||
|
||||
t := addHashTab (t, a, 800);
|
||||
validateColl (t);
|
||||
|
||||
printf ("Replaced: %s\n", findHashTab (t, a).string);
|
||||
|
||||
t := removeHashTab (t, a);
|
||||
validateColl (t);
|
||||
printf ("Restored: %s\n", findHashTab (t, a).string)
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue