]> gitweb.factorcode.org Git - factor.git/commitdiff
hashtables: testing that associate and H{ } set-at have same characteristics.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 3 Aug 2012 15:30:55 +0000 (08:30 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 3 Aug 2012 15:30:55 +0000 (08:30 -0700)
core/hashtables/hashtables-tests.factor

index 541f98ab9ca3ecbe00ac4c3996f84343568d0346..40ccfc4e9a53801755e75fc44a2438a7189578a8 100644 (file)
@@ -1,6 +1,6 @@
-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
@@ -19,6 +19,12 @@ unit-test
 [ { 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