Example #1
0
 public void Setup()
 {
     _comparer = GetStringComparer();
     char[] characters = ValuesGenerator.Array <char>(Count);
     _input = new string(characters);
     _same  = new string(characters);
 }
            static string CreateFileWithRandomContent(long fileSize)
            {
                string filePath = FileUtils.GetTestFilePath();

                File.WriteAllBytes(filePath, ValuesGenerator.Array <byte>((int)fileSize));
                return(filePath);
            }
Example #3
0
 private void Setup(params long[] fileSizes)
 {
     _userBuffers = new Dictionary <int, byte[]>()
     {
         { HalfKibibyte, ValuesGenerator.Array <byte>(HalfKibibyte) },
         { FourKibibytes, ValuesGenerator.Array <byte>(FourKibibytes) },
     };
     _sourceFilePaths      = fileSizes.ToDictionary(size => size, size => CreateFileWithRandomContent(size));
     _destinationFilePaths = fileSizes.ToDictionary(size => size, size => CreateFileWithRandomContent(size));
Example #4
0
 public void SetupWriteAllBytes()
 {
     _testFilePath = FileUtils.GetTestFilePath();
     _userBuffers  = new Dictionary <int, byte[]>()
     {
         { HalfKibibyte, ValuesGenerator.Array <byte>(HalfKibibyte) },
         { FourKibibytes, ValuesGenerator.Array <byte>(FourKibibytes) },
         { SixteenKibibytes, ValuesGenerator.Array <byte>(SixteenKibibytes) },
         { OneMibibyte, ValuesGenerator.Array <byte>(OneMibibyte) },
         { HundredMibibytes, ValuesGenerator.Array <byte>(HundredMibibytes) },
     };
 }
 private void Setup(params long[] fileSizes)
 {
     _sizeToBuffer = new Dictionary <int, byte[]>()
     {
         { FourKibibytes, ValuesGenerator.Array <byte>(FourKibibytes) },
         { SixteenKibibytes, ValuesGenerator.Array <byte>(SixteenKibibytes) },
     };
     _sizeToBuffers = new Dictionary <int, byte[][]>()
     {
         { SixteenKibibytes, Enumerable.Range(0, 4).Select(_ => ValuesGenerator.Array <byte>(FourKibibytes)).ToArray() },
         { SixtyFourKibibytes, Enumerable.Range(0, 4).Select(_ => ValuesGenerator.Array <byte>(SixteenKibibytes)).ToArray() },
     };
     _sourceFilePaths      = fileSizes.ToDictionary(size => size, size => CreateFileWithRandomContent(size));
     _destinationFilePaths = fileSizes.ToDictionary(size => size, size => CreateFileWithRandomContent(size));
Example #6
0
 public TestInput(double pB, double pD)
 {
     _pB   = pB;
     _pD   = pD;
     Array = ValuesGenerator.Array <double>(N).Select(p =>
     {
         if (p <= _pB)
         {
             return(new B());
         }
         if (p <= _pB + _pD)
         {
             return(new D());
         }
         return(new E());
     }).ToArray();
 }
Example #7
0
        public void SetupReadAllBytes()
        {
            // use non-temp file path to ensure that we don't test some unusal File System on Unix
            string baseDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            File.WriteAllBytes(_testFilePath = Path.Combine(baseDir, Path.GetTempFileName()), Array.Empty <byte>());
            _filesToRead = new Dictionary <int, string>()
            {
                { HalfKibibyte, WriteBytes(HalfKibibyte) },
                { FourKibibytes, WriteBytes(FourKibibytes) },
                { SixteenKibibytes, WriteBytes(SixteenKibibytes) },
                { OneMibibyte, WriteBytes(OneMibibyte) },
                { HundredMibibytes, WriteBytes(HundredMibibytes) },
            };

            string WriteBytes(int fileSize)
            {
                string filePath = Path.Combine(baseDir, Path.GetTempFileName());

                File.WriteAllBytes(filePath, ValuesGenerator.Array <byte>(fileSize));
                return(filePath);
            }
        }
Example #8
0
 public void Setup()
 {
     _source      = ValuesGenerator.Array <byte>(NumberOfBytes);
     _destination = new byte[Base64.GetMaxEncodedToUtf8Length(NumberOfBytes)];
 }
Example #9
0
 public void SetupBase64Encode()
 {
     _decodedBytes = ValuesGenerator.Array <byte>(NumberOfBytes);
     _encodedBytes = new byte[Base64.GetMaxEncodedToUtf8Length(NumberOfBytes)];
 }
 public TestInput(double pB)
 {
     _pB   = pB;
     Array = ValuesGenerator.Array <double>(N).Select(p => p > _pB ? new D() : new B()).ToArray();
 }
Example #11
0
 public MemoryMarshal()
 {
     _array  = ValuesGenerator.Array <T>(Utils.DefaultCollectionSize);
     _memory = new System.ReadOnlyMemory <T>(_array);
 }
Example #12
0
 public void SetupMemorySegment() => _memory = new ReadOnlyMemory <T>(_array = ValuesGenerator.Array <T>(Size));
Example #13
0
 public void Setup_BitArrayCopyToBoolArray()
 {
     _bytes    = ValuesGenerator.Array <byte>(Size);
     _original = new BitArray(_bytes);
     _bools    = new bool[Size * 32];
 }
Example #14
0
 public void SetupSingleSegment() => _startSegment = _endSegment = new BufferSegment <T>(new ReadOnlyMemory <T>(_array = ValuesGenerator.Array <T>(Size)));
Example #15
0
 public void SetupConvertTryFromBase64Chars()
 {
     _decodedBytes = ValuesGenerator.Array <byte>(NumberOfBytes);
     _encodedChars = Convert.ToBase64String(_decodedBytes).ToCharArray();
 }
Example #16
0
 public void Setup_BitArrayShift() => _original = new BitArray(ValuesGenerator.Array <byte>(Size));
Example #17
0
 public void Setup_BitArrayAnd()
 {
     _original  = new BitArray(ValuesGenerator.Array <byte>(Size));
     _original2 = new BitArray(ValuesGenerator.Array <byte>(Size));
 }
Example #18
0
 public void Setup_BitArrayIntArrayCtor() => _ints = ValuesGenerator.Array <int>(Size);
Example #19
0
 public void Setup_BitArrayByteArrayCtor() => _bytes = ValuesGenerator.Array <byte>(Size);
Example #20
0
 public void Setup_BitArrayBoolArrayCtor() => _bools = ValuesGenerator.Array <bool>(Size);
Example #21
0
 public void SetupConvertToBase64CharArray()
 {
     _decodedBytes = ValuesGenerator.Array <byte>(NumberOfBytes);
     _encodedChars = new char[Base64.GetMaxEncodedToUtf8Length(NumberOfBytes)];
 }
Example #22
0
 public void Setup() => _memory = new System.ReadOnlyMemory <T>(ValuesGenerator.Array <T>(Size));
Example #23
0
 public void SetupBase64DecodeDetinationTooSmall()
 {
     _encodedBytes = ValuesGenerator.Array <byte>(NumberOfBytes);
     _decodedBytes = new byte[Base64.GetMaxEncodedToUtf8Length(NumberOfBytes) - 1];
 }
Example #24
0
 public void Setup_BitArrayCopyToIntArray()
 {
     _bytes    = ValuesGenerator.Array <byte>(Size);
     _original = new BitArray(_bytes);
     _ints     = new int[Size / 4];
 }
Example #25
0
 public void Setup()
 {
     _array = ValuesGenerator.Array <T>(Size);
     _same  = _array.ToArray();
 }
Example #26
0
 public void Setup()
 {
     _srcData = ValuesGenerator.Array <byte>(Size);
     _dstData = ValuesGenerator.Array <byte>(Size);
 }
Example #27
0
 public void SetupArray() => _array = ValuesGenerator.Array <T>(Size);
Example #28
0
 public void Setup_BitArrayCopyToByteArray()
 {
     _bytes    = ValuesGenerator.Array <byte>(Size);
     _original = new BitArray(_bytes);
 }