! Copyright (C) 2022 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: kernel multisets prettyprint tools.test ;
+USING: accessors kernel multisets prettyprint tools.test ;
IN: multisets.tests
{ multiset{ } } [
{ } [ multiset{ 100 100 } [ . ] multiset-each ] unit-test
+
+{ 0 } [ multiset{ } size>> ] unit-test
+{ 0 } [ multiset{ 100 100 } [ multiset-clear ] [ size>> ] bi ] unit-test
+{ 2 } [ multiset{ 100 100 } size>> ] unit-test
: multiset-clear ( multiset -- )
[ hash>> clear-assoc ]
- [ avl>> f >>root 0 >>count drop ] bi ;
+ [ avl>> f >>root 0 >>count drop ]
+ [ 0 >>size drop ] tri ;
: multiset-empty? ( multiset -- ? ) avl>> assoc-size 0 eq? ; inline