예제 #1
0
    public static void TestIsProperSubsetEnum()
    {
        RandomTGenerator <int> intGenerator = new RandomTGenerator <int>(InstanceCreators.IntGenerator);

        int[]         startingElements   = intGenerator.MakeNewTs(MaxStartSize);
        int[]         stuffToCheckSubset = intGenerator.GenerateMixedSelection(startingElements, InitialSetSize_small);
        HashSet <int> theSet             = new HashSet <int>();

        theSet.UnionWith(startingElements);

        foreach (var iteration in Benchmark.Iterations)
        {
            using (iteration.StartMeasurement())
                theSet.IsProperSubsetOf(stuffToCheckSubset);
        }
    }
예제 #2
0
    public static void Union_NoOp(int startSize, int countToUnion)
    {
        RandomTGenerator <int> intGenerator = new RandomTGenerator <int>(InstanceCreators.IntGenerator);

        int[]         startingElements = intGenerator.MakeNewTs(MaxStartSize);
        int[]         stuffToUnion     = intGenerator.GenerateMixedSelection(startingElements, countToUnion);
        HashSet <int> theSet           = new HashSet <int>(startingElements);

        theSet.UnionWith(stuffToUnion);

        foreach (var iteration in Benchmark.Iterations)
        {
            using (iteration.StartMeasurement())
                theSet.UnionWith(stuffToUnion);
        }
    }
예제 #3
0
    public static void SymmetricExceptEnum(int startSize, int countToExcept)
    {
        RandomTGenerator <int> intGenerator = new RandomTGenerator <int>(InstanceCreators.IntGenerator);

        int[]         startingElements = intGenerator.MakeNewTs(startSize);
        int[]         stuffToExcept    = intGenerator.GenerateMixedSelection(startingElements, countToExcept);
        HashSet <int> theSet           = new HashSet <int>();

        foreach (var iteration in Benchmark.Iterations)
        {
            theSet.UnionWith(startingElements);

            using (iteration.StartMeasurement())
                theSet.SymmetricExceptWith(stuffToExcept);

            theSet.Clear();
        }
    }