示例#1
0
        private void Validate_IsProperSupersetOf(PooledSet <T> set, Span <T> span)
        {
            bool isProperSuperset = true;
            bool setContainsElementsNotInEnumerable = false;
            IEqualityComparer <T> comparer          = set.Comparer;

            foreach (T value in span)
            {
                if (!set.Contains(value))
                {
                    isProperSuperset = false;
                    break;
                }
            }
            foreach (T value in set)
            {
                if (!SpanContains(span, value, comparer))
                {
                    setContainsElementsNotInEnumerable = true;
                    break;
                }
            }
            isProperSuperset = isProperSuperset && setContainsElementsNotInEnumerable;
            Assert.Equal(isProperSuperset, set.IsProperSupersetOf(span));
        }