]> gitweb.factorcode.org Git - factor.git/blobdiff - core/sets/sets-tests.factor
sets: adding ?delete that returns a boolean if elt was deleted from set.
[factor.git] / core / sets / sets-tests.factor
index 0ffd8aff08777cdf276e0c57ec98ea8663b1f9c8..0e2a23a593f49fdf443d2e73bba4cfefc2a58038 100644 (file)
@@ -6,6 +6,8 @@ IN: sets.tests
 
 { V{ 1 2 3 } } [ 3 V{ 1 2 } clone [ adjoin ] keep ] unit-test
 { V{ 1 2 } } [ 2 V{ 1 2 } clone [ adjoin ] keep ] unit-test
+{ t } [ 1 V{ } ?adjoin ] unit-test
+{ f } [ 1 V{ 1 } ?adjoin ] unit-test
 
 { t } [ 4 { 2 4 5 } in? ] unit-test
 { f } [ 1 { 2 4 5 } in? ] unit-test
@@ -13,6 +15,8 @@ IN: sets.tests
 
 { V{ 1 2 } } [ 3 V{ 1 2 } clone [ delete ] keep ] unit-test
 { V{ 2 } } [ 1 V{ 1 2 } clone [ delete ] keep ] unit-test
+{ t } [ 1 V{ 1 } ?delete ] unit-test
+{ f } [ 1 V{ } ?delete ] unit-test
 { 0 } [ 5 <bit-set> 0 over delete cardinality ] unit-test
 { 0 } [ 5 <bit-set> f over delete cardinality ] unit-test
 { 0 } [ 5 <bit-set> 3 over adjoin 3 over delete cardinality ] unit-test