-USING: kernel math namespaces make tools.test vectors sequences
-sequences.private hashtables io prettyprint assocs
-continuations ;
+USING: accessors assocs continuations hashtables io kernel make
+math namespaces prettyprint sequences sequences.private
+tools.test vectors ;
IN: hashtables.tests
[ H{ } ] [ { } [ dup ] H{ } map>assoc ] unit-test
[ ] [ 1000 iota [ dup sq ] H{ } map>assoc "testhash" set ] unit-test
[ V{ } ]
-[ 1000 iota [ dup sq swap "testhash" get at = not ] filter ]
+[ 1000 iota [ dup sq swap "testhash" get at = ] reject ]
unit-test
[ t ]
[ { 1 { 2 3 } } hashtable? ]
unit-test
+{ t } [
+ "value" "key"
+ [ associate ] [ H{ } clone [ set-at ] keep ] 2bi
+ [ = ] [ [ array>> length ] bi@ = ] 2bi and
+] unit-test
+
! Test some hashcodes.
[ t ] [ [ 1 2 3 ] hashcode [ 1 2 3 ] hashcode = ] unit-test
[ 1 ] [ 2 "h" get at ] unit-test
! Random test case
-[ "A" ] [ 100 iota [ dup ] H{ } map>assoc 32 over delete-at "A" 32 pick set-at 32 swap at ] unit-test
+[ "A" ] [ 100 iota [ dup ] H{ } map>assoc 32 over delete-at "A" 32 pick set-at 32 of ] unit-test