Ejemplo n.º 1
0
        public void Resize_NewSizeLessThanZero()
        {
            int[] array   = { 0 };
            int   newSize = -1;

            Assert.Throws <ArgumentOutOfRangeException>(() => NArr.Resize(ref array, newSize));
        }
Ejemplo n.º 2
0
        public void AppendSingleElement()
        {
            byte[] array      = new byte[0];
            byte[] collection = new byte[1];

            NArr.Append(ref array, collection);
        }
Ejemplo n.º 3
0
        public void Shift_CountIsTooLarge()
        {
            int[] array = { 0, 0 };
            int   count = 3;

            Assert.Throws <ArgumentOutOfRangeException>(() => NArr.Shift(ref array, count));
        }
Ejemplo n.º 4
0
        public void AppendLargeCollection()
        {
            byte[] array      = new byte[0];
            byte[] collection = new byte[100000000];

            NArr.Append(ref array, collection);
        }
Ejemplo n.º 5
0
        public void Append_NullArray()
        {
            int[] array      = null;
            int[] collection = { 6, 7 };

            Assert.Throws <ArgumentNullException>(() => NArr.Append(ref array, collection));
        }
Ejemplo n.º 6
0
        public void Resize_NullArray()
        {
            int[] array   = null;
            int   newSize = 1;

            Assert.Throws <ArgumentNullException>(() => NArr.Resize(ref array, newSize));
        }
Ejemplo n.º 7
0
        public void Shift_EmptyArray()
        {
            int[] array = { };
            int   count = 1;

            Assert.Throws <ArgumentOutOfRangeException>(() => NArr.Shift(ref array, count));
        }
Ejemplo n.º 8
0
        public void Append_NullCollection()
        {
            int[] array      = { 0, 1, 2, 3, 4, 5 };
            int[] collection = null;

            Assert.Throws <ArgumentNullException>(() => NArr.Append(ref array, collection));
        }
Ejemplo n.º 9
0
        public void Insert_NullCollection()
        {
            int[] array      = { 0, 1, 2, 5, 6, 7 };
            int[] collection = null;
            int   index      = 3;

            Assert.Throws <ArgumentNullException>(() => NArr.Insert(ref array, collection, index));
        }
Ejemplo n.º 10
0
        public byte[] SmallArrayToLargerArray()
        {
            byte[] array = new byte[10];

            NArr.Resize(ref array, 100);

            return(array);
        }
Ejemplo n.º 11
0
        public void Insert_IndexIsTooSmall()
        {
            int[] array      = { };
            int[] collection = { };
            int   index      = -1;

            Assert.Throws <ArgumentOutOfRangeException>(() => NArr.Insert(ref array, collection, index));
        }
Ejemplo n.º 12
0
        public void Insert_NullArray()
        {
            int[] array      = null;
            int[] collection = { 3, 4 };
            int   index      = 3;

            Assert.Throws <ArgumentNullException>(() => NArr.Insert(ref array, collection, index));
        }
Ejemplo n.º 13
0
        public void Remove_CountIsTooSmall()
        {
            int[] array = { 0 };
            int   count = -1;
            int   index = 0;

            Assert.Throws <ArgumentOutOfRangeException>(() => NArr.Remove(ref array, count, index));
        }
Ejemplo n.º 14
0
        public byte[] SmallCollectionFromSmallArray()
        {
            byte[] array = new byte[100];

            NArr.Remove(ref array, 10, 0);

            return(array);
        }
Ejemplo n.º 15
0
        public byte[] LargeCollectionFromLargeArray()
        {
            byte[] array = new byte[100000];

            NArr.Remove(ref array, 50000, 49999);

            return(array);
        }
Ejemplo n.º 16
0
        public byte[] PositiveShiftOfSmallArray()
        {
            byte[] array = new byte[100];

            NArr.Shift(ref array, 1);

            return(array);
        }
Ejemplo n.º 17
0
        public byte[] NegativeShiftOfLargeArray()
        {
            byte[] array = new byte[100000];

            NArr.Shift(ref array, -1);

            return(array);
        }
Ejemplo n.º 18
0
        public void Remove_IndexIsTooLarge()
        {
            int[] array = { 0 };
            int   count = 1;
            int   index = 1;

            Assert.Throws <ArgumentOutOfRangeException>(() => NArr.Remove(ref array, count, index));
        }
Ejemplo n.º 19
0
        public void Remove_EmptyArray()
        {
            int[] array = { };
            int   count = 0;
            int   index = 0;

            Assert.Throws <ArgumentOutOfRangeException>(() => NArr.Remove(ref array, count, index));
        }
Ejemplo n.º 20
0
        public byte[] SmallCollectionInSmallArray()
        {
            byte[] array = new byte[100];

            NArr.Move(ref array, 0, 50, 49);

            return(array);
        }
Ejemplo n.º 21
0
        public void Move_EmptyArray()
        {
            int[] array = { };
            int   from  = 0;
            int   count = 1;
            int   to    = 1;

            Assert.Throws <ArgumentException>(() => NArr.Move(ref array, from, count, to));
        }
Ejemplo n.º 22
0
        public void Move_ToIndexIsTooSmall()
        {
            int[] array = { 0, 1 };
            int   from  = 0;
            int   count = 1;
            int   to    = -1;

            Assert.Throws <ArgumentOutOfRangeException>(() => NArr.Move(ref array, from, count, to));
        }
Ejemplo n.º 23
0
        public void Move_NullArray()
        {
            int[] array = null;
            int   from  = 0;
            int   count = 1;
            int   to    = 1;

            Assert.Throws <ArgumentNullException>(() => NArr.Move(ref array, from, count, to));
        }
Ejemplo n.º 24
0
        public void Move_CountIsTooLarge()
        {
            int[] array = { 0, 1 };
            int   from  = 0;
            int   count = 3;
            int   to    = 0;

            Assert.Throws <ArgumentOutOfRangeException>(() => NArr.Move(ref array, from, count, to));
        }
Ejemplo n.º 25
0
        public byte[] SmallCollectionIntoEmptyArray()
        {
            byte[] array      = new byte[0];
            byte[] collection = new byte[100];

            NArr.Insert(ref array, collection, 0);

            return(array);
        }
Ejemplo n.º 26
0
        public byte[] LargeCollectionIntoLargeArray()
        {
            byte[] array      = new byte[100000];
            byte[] collection = new byte[100000];

            NArr.Insert(ref array, collection, 49999);

            return(array);
        }
Ejemplo n.º 27
0
        public void Resize_DecreaseSize_IsExpected()
        {
            int[] array   = { 0, 1, 2, 3, 4, 5, 6, 7 };
            int   newSize = 7;

            int[] expected = { 0, 1, 2, 3, 4, 5, 6 };
            NArr.Resize(ref array, newSize);

            Assert.AreEqual(expected, array);
        }
Ejemplo n.º 28
0
        public void Append_IsExpected()
        {
            int[] array      = { 0, 1, 2, 3, 4, 5 };
            int[] collection = { 6, 7 };

            int[] expected = { 0, 1, 2, 3, 4, 5, 6, 7 };
            NArr.Append(ref array, collection);

            Assert.AreEqual(expected, array);
        }
Ejemplo n.º 29
0
        public void Resize_ArrayLengthEqualsNewSize()
        {
            int[] array   = { 0, 1, 2, 3, 4, 5, 6, 7 };
            int   newSize = 8;

            int[] expected = { 0, 1, 2, 3, 4, 5, 6, 7 };
            NArr.Resize(ref array, newSize);

            Assert.AreEqual(expected, array);
        }
Ejemplo n.º 30
0
        public void Shift_IsExpected()
        {
            int[] array = { 0, 1, 2, 3, 4, 5, 6, 7 };
            int   count = 3;

            int[] expected = { 5, 6, 7, 0, 1, 2, 3, 4 };
            NArr.Shift(ref array, count);

            Assert.AreEqual(expected, array);
        }