Example #1
0
 public void SetupHashSet()
 {
     _found   = ValuesGenerator.ArrayOfUniqueValues <T>(Size);
     _hashSet = new HashSet <T>(_found);
 }
Example #2
0
 public void SetupSortedList() => _sortedlist = new SortedList <T, T>(ValuesGenerator.Dictionary <T, T>(Size));
Example #3
0
 public void SetupSortedDictionary() => _sorteddictionary = new SortedDictionary <T, T>(ValuesGenerator.Dictionary <T, T>(Size));
Example #4
0
 public void SetupHashSet() => _hashset = new HashSet <T>(ValuesGenerator.ArrayOfUniqueValues <T>(Size));
Example #5
0
 public void SetupQueue() => _queue = new Queue <T>(ValuesGenerator.ArrayOfUniqueValues <T>(Size));
Example #6
0
 public void Setup() => _uniqueValues = ValuesGenerator.ArrayOfUniqueValues <T>(Size);
 public TestInput(double pB)
 {
     _pB   = pB;
     Array = ValuesGenerator.Array <double>(N).Select(p => p > _pB ? new D() : new B()).ToArray();
 }
Example #8
0
 public void SetupList()
 {
     _found = ValuesGenerator.ArrayOfUniqueValues <T>(Size);
     _list  = new List <T>(_found);
 }
Example #9
0
 public void Setup_BitArrayCopyToIntArray()
 {
     _bytes    = ValuesGenerator.Array <byte>(Size);
     _original = new BitArray(_bytes);
     _ints     = new int[Size / 4];
 }
Example #10
0
 public void SetupImmutableSortedSet()
 {
     _found = ValuesGenerator.ArrayOfUniqueValues <T>(Size);
     _immutableSortedSet = Immutable.ImmutableSortedSet.CreateRange <T>(_found);
 }
Example #11
0
 public void SetupArray()
 {
     _found = ValuesGenerator.ArrayOfUniqueValues <T>(Size);
     _array = _found.ToArray();
 }
Example #12
0
 public void SetupSortedSet()
 {
     _found     = ValuesGenerator.ArrayOfUniqueValues <T>(Size);
     _sortedSet = new SortedSet <T>(_found);
 }
Example #13
0
 public void SetupStack()
 {
     _found = ValuesGenerator.ArrayOfUniqueValues <T>(Size);
     _stack = new Stack <T>(_found);
 }
Example #14
0
 public void SetupQueue()
 {
     _found = ValuesGenerator.ArrayOfUniqueValues <T>(Size);
     _queue = new Queue <T>(_found);
 }
 public void Setup()
 {
     _collection = ValuesGenerator.ArrayOfUniqueValues <T>(Size);
     _dictionary = ValuesGenerator.Dictionary <T, T>(Size);
 }
Example #16
0
 public void Setup_BitArrayCopyToByteArray()
 {
     _bytes    = ValuesGenerator.Array <byte>(Size);
     _original = new BitArray(_bytes);
 }
Example #17
0
        internal static T Generate <T>()
        {
            if (typeof(T) == typeof(LoginViewModel))
            {
                return((T)(object)CreateLoginViewModel());
            }
            if (typeof(T) == typeof(Location))
            {
                return((T)(object)CreateLocation());
            }
            if (typeof(T) == typeof(IndexViewModel))
            {
                return((T)(object)CreateIndexViewModel());
            }
            if (typeof(T) == typeof(MyEventsListerViewModel))
            {
                return((T)(object)CreateMyEventsListerViewModel());
            }
            if (typeof(T) == typeof(BinaryData))
            {
                return((T)(object)CreateBinaryData(1024));
            }
            if (typeof(T) == typeof(CollectionsOfPrimitives))
            {
                return((T)(object)CreateCollectionsOfPrimitives(1024)); // 1024 values was copied from CoreFX benchmarks
            }
            if (typeof(T) == typeof(XmlElement))
            {
                return((T)(object)CreateXmlElement());
            }
            if (typeof(T) == typeof(SimpleStructWithProperties))
            {
                return (T)(object)new SimpleStructWithProperties {
                           Num = 1, Text = "Foo"
                }
            }
            ;
            if (typeof(T) == typeof(SimpleListOfInt))
            {
                return (T)(object)new SimpleListOfInt {
                           10, 20, 30
                }
            }
            ;
            if (typeof(T) == typeof(ClassImplementingIXmlSerialiable))
            {
                return (T)(object)new ClassImplementingIXmlSerialiable {
                           StringValue = "Hello world"
                }
            }
            ;
            if (typeof(T) == typeof(Dictionary <string, string>))
            {
                return((T)(object)ValuesGenerator.ArrayOfUniqueValues <string>(100).ToDictionary(value => value));
            }
            if (typeof(T) == typeof(ImmutableDictionary <string, string>))
            {
                return((T)(object)ImmutableDictionary.CreateRange(ValuesGenerator.ArrayOfUniqueValues <string>(100).ToDictionary(value => value)));
            }
            if (typeof(T) == typeof(ImmutableSortedDictionary <string, string>))
            {
                return((T)(object)ImmutableSortedDictionary.CreateRange(ValuesGenerator.ArrayOfUniqueValues <string>(100).ToDictionary(value => value)));
            }
            if (typeof(T) == typeof(HashSet <string>))
            {
                return((T)(object)new HashSet <string>(ValuesGenerator.ArrayOfUniqueValues <string>(100)));
            }
            if (typeof(T) == typeof(ArrayList))
            {
                return((T)(object)new ArrayList(ValuesGenerator.ArrayOfUniqueValues <string>(100)));
            }
            if (typeof(T) == typeof(Hashtable))
            {
                return((T)(object)new Hashtable(ValuesGenerator.ArrayOfUniqueValues <string>(100).ToDictionary(value => value)));
            }


            throw new NotImplementedException();
        }
Example #18
0
 public void Setup_BitArrayCopyToBoolArray()
 {
     _bytes    = ValuesGenerator.Array <byte>(Size);
     _original = new BitArray(_bytes);
     _bools    = new bool[Size * 32];
 }
Example #19
0
 public void SetupDictionary() => _dictionary = new ConcurrentDictionary <T, T>(ValuesGenerator.ArrayOfUniqueValues <T>(Size).ToDictionary(v => v, v => v));
Example #20
0
 public void Setup_BitArrayBoolArrayCtor() => _bools = ValuesGenerator.Array <bool>(Size);
Example #21
0
 public void SetupLinkedList() => _linkedlist = new LinkedList <T>(ValuesGenerator.ArrayOfUniqueValues <T>(Size));
Example #22
0
 public void Setup_BitArrayByteArrayCtor() => _bytes = ValuesGenerator.Array <byte>(Size);
Example #23
0
 public void SetupDictionary() => _dictionary = new Dictionary <T, T>(ValuesGenerator.Dictionary <T, T>(Size));
Example #24
0
 public void Setup_BitArrayIntArrayCtor() => _ints = ValuesGenerator.Array <int>(Size);
Example #25
0
 public void SetupStack() => _stack = new Stack <T>(ValuesGenerator.ArrayOfUniqueValues <T>(Size));
Example #26
0
 public void Setup_BitArrayShift() => _original = new BitArray(ValuesGenerator.Array <byte>(Size));
Example #27
0
 public void SetupSortedSet() => _sortedset = new SortedSet <T>(ValuesGenerator.ArrayOfUniqueValues <T>(Size));
Example #28
0
 public void Setup_BitArrayAnd()
 {
     _original  = new BitArray(ValuesGenerator.Array <byte>(Size));
     _original2 = new BitArray(ValuesGenerator.Array <byte>(Size));
 }
Example #29
0
 public void SetupConcurrentDictionary() => _concurrentdictionary = new ConcurrentDictionary <T, T>(ValuesGenerator.Dictionary <T, T>(Size));
 public MemoryMarshal()
 {
     _array  = ValuesGenerator.Array <T>(Utils.DefaultCollectionSize);
     _memory = new System.ReadOnlyMemory <T>(_array);
 }