]> gitweb.factorcode.org Git - factor.git/blobdiff - core/hashtables/hashtables-tests.factor
ui.listener: document that ~/.factor-history persists input history
[factor.git] / core / hashtables / hashtables-tests.factor
index 1ae6ad353ce689df3b742362f27dc61826ce88a5..96ae5f71a949d1aec30c55842244d4617b801854 100644 (file)
@@ -1,18 +1,12 @@
-USING: accessors arrays assocs continuations fry hashtables
-hashtables.private kernel make math memory namespaces sequences
-tools.test ;
-
-! hash@
-{ 18 } [
-    77 20 f <array> hash@
-] unit-test
+USING: accessors assocs continuations hashtables kernel make
+math namespaces sequences tools.test ;
 
 { H{ } } [ { } [ dup ] H{ } map>assoc ] unit-test
 
-{ } [ 1000 iota [ dup sq ] H{ } map>assoc "testhash" set ] unit-test
+{ } [ 1000 <iota> [ dup sq ] H{ } map>assoc "testhash" set ] unit-test
 
 { V{ } }
-[ 1000 iota [ dup sq swap "testhash" get at = ] reject ]
+[ 1000 <iota> [ dup sq swap "testhash" get at = ] reject ]
 unit-test
 
 { t }
@@ -147,7 +141,7 @@ H{ } "x" set
 
 ! make sure growth and capacity use same load-factor
 { t } [
-    100 iota
+    100 <iota>
     [ [ <hashtable> ] map ]
     [ [ H{ } clone [ '[ dup _ set-at ] each-integer ] keep ] map ] bi
     [ [ array>> length ] bi@ = ] 2all?
@@ -188,14 +182,5 @@ H{ } "x" set
 
 { 1 } [ 2 "h" get at ] unit-test
 
-! Previously this could break as hashtable new created a backing an
-! empty backing array and the code assumed its length was > 0.
-{ f f } [
-    compact-gc 77 hashtable new [ clone ] change-array at*
-] unit-test
-
 ! Random test case
-{ "A" } [
-    100 iota [ dup ] H{ } map>assoc 32 over
-    delete-at "A" 32 pick set-at 32 of
-] unit-test
+{ "A" } [ 100 <iota> [ dup ] H{ } map>assoc 32 over delete-at "A" 32 pick set-at 32 of ] unit-test