public void GlobalSetup()
        {
            var intGenerator = new RandomTGenerator <int>(InstanceCreators.IntGenerator);

            int[] startingElements = intGenerator.MakeNewTs(InitialSetSize);
            stuffToUnion = intGenerator.GenerateMixedSelection(startingElements, CountToUnion);

            hashSet = new HashSet <int>(startingElements);
            hashSet.UnionWith(stuffToUnion);
            pooledSet = new PooledSet <int>(startingElements);
            pooledSet.UnionWith(stuffToUnion);
        }
Ejemplo n.º 2
0
        private void Validate_UnionWith(PooledSet <T> set, Span <T> span)
        {
            IEqualityComparer <T> comparer = set.Comparer;
            PooledSet <T>         expected = new PooledSet <T>(set, comparer);

            RegisterForDispose(expected);
            foreach (T element in span)
            {
                if (!set.Contains(element))
                {
                    expected.Add(element);
                }
            }
            set.UnionWith(span);
            Assert.Equal(expected.Count, set.Count);
            Assert.True(expected.SetEquals(set));
        }
Ejemplo n.º 3
0
 public void IterationSetup()
 {
     hashSet.UnionWith(startingElements);
     pooledSet.UnionWith(startingElements);
 }
Ejemplo n.º 4
0
 public void PooledIterationSetup()
 {
     pooledSet.UnionWith(startingElements);
 }