Example #1
0
        public void Resize_NewSizeLessThanZero()
        {
            int[] array   = { 0 };
            int   newSize = -1;

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

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

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

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

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

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

            Assert.Throws <ArgumentOutOfRangeException>(() => NArr.Shift(ref array, count));
        }
Example #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));
        }
Example #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));
        }
Example #10
0
        public byte[] SmallArrayToLargerArray()
        {
            byte[] array = new byte[10];

            NArr.Resize(ref array, 100);

            return(array);
        }
Example #11
0
        public void Insert_IndexIsTooSmall()
        {
            int[] array      = { };
            int[] collection = { };
            int   index      = -1;

            Assert.Throws <ArgumentOutOfRangeException>(() => NArr.Insert(ref array, collection, index));
        }
Example #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));
        }
Example #13
0
        public void Remove_CountIsTooSmall()
        {
            int[] array = { 0 };
            int   count = -1;
            int   index = 0;

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

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

            return(array);
        }
Example #15
0
        public byte[] LargeCollectionFromLargeArray()
        {
            byte[] array = new byte[100000];

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

            return(array);
        }
Example #16
0
        public byte[] PositiveShiftOfSmallArray()
        {
            byte[] array = new byte[100];

            NArr.Shift(ref array, 1);

            return(array);
        }
Example #17
0
        public byte[] NegativeShiftOfLargeArray()
        {
            byte[] array = new byte[100000];

            NArr.Shift(ref array, -1);

            return(array);
        }
Example #18
0
        public void Remove_IndexIsTooLarge()
        {
            int[] array = { 0 };
            int   count = 1;
            int   index = 1;

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

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

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

            return(array);
        }
Example #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));
        }
Example #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));
        }
Example #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));
        }
Example #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));
        }
Example #25
0
        public byte[] SmallCollectionIntoEmptyArray()
        {
            byte[] array      = new byte[0];
            byte[] collection = new byte[100];

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

            return(array);
        }
Example #26
0
        public byte[] LargeCollectionIntoLargeArray()
        {
            byte[] array      = new byte[100000];
            byte[] collection = new byte[100000];

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

            return(array);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }