Esempio n. 1
0
        public void DoubledArrayReturnsNullIfNullArrayProvided()
        {
            int[] array = null;

            var doubled = ArrayFunctions.DoubleArraySizeAndKeepContents <int>(array);

            Assert.Null(doubled);
        }
Esempio n. 2
0
        public void DoublesArraySize()
        {
            var array = new float[4];

            var doubled = ArrayFunctions.DoubleArraySizeAndKeepContents <float>(array);

            Assert.Equal(8, doubled.Length);
        }
Esempio n. 3
0
 private void CheckAndUpsizeIndexArray(int numToAdd)
 {
     while (Data.NumIndicesUsed + numToAdd >= Data.QueueSizeIndex)
     {
         Data.Indices         = ArrayFunctions.DoubleArraySizeAndKeepContents <int>(Data.Indices);
         Data.QueueSizeIndex *= 2;
     }
 }
Esempio n. 4
0
 private void CheckAndUpsizeVertexArray(int numToAdd)
 {
     while (Data.NumVerticesUsed + numToAdd >= Data.QueueSizeVertex)
     {
         Data.Vertices         = ArrayFunctions.DoubleArraySizeAndKeepContents <Vertex2D>(Data.Vertices);
         Data.QueueSizeVertex *= 2;
     }
 }
Esempio n. 5
0
        public void DoubledArrayDoesNotContainDataInSecondHalf()
        {
            var array = new object[] { new object(), new object(), new object(), new object() };

            var doubled = ArrayFunctions.DoubleArraySizeAndKeepContents <object>(array);

            for (var n = 4; n < 8; n++)
            {
                Assert.Null(doubled[n]);
            }
        }
Esempio n. 6
0
        public void DoubledArrayKeepsContent()
        {
            var array = new float[] { 3.0f, 2.0f, 1.0f, 5.0f };

            var doubled = ArrayFunctions.DoubleArraySizeAndKeepContents <float>(array);

            for (var n = 0; n < 4; n++)
            {
                Assert.Equal(array[n], doubled[n]);
            }
        }
Esempio n. 7
0
 private void DoubleSinglePropertyArrays()
 {
     Data.Ordering            = ArrayFunctions.DoubleArraySizeAndKeepContents <int>(Data.Ordering);
     Data.Targets             = ArrayFunctions.DoubleArraySizeAndKeepContents <CoordinateSpace>(Data.Targets);
     Data.Types               = ArrayFunctions.DoubleArraySizeAndKeepContents <FillType>(Data.Types);
     Data.BaseColours         = ArrayFunctions.DoubleArraySizeAndKeepContents <Colour>(Data.BaseColours);
     Data.NumVertices         = ArrayFunctions.DoubleArraySizeAndKeepContents <int>(Data.NumVertices);
     Data.FirstVertexPosition = ArrayFunctions.DoubleArraySizeAndKeepContents <int>(Data.FirstVertexPosition);
     Data.NumIndices          = ArrayFunctions.DoubleArraySizeAndKeepContents <int>(Data.NumIndices);
     Data.FirstIndexPosition  = ArrayFunctions.DoubleArraySizeAndKeepContents <int>(Data.FirstIndexPosition);
     Data.Texture0            = ArrayFunctions.DoubleArraySizeAndKeepContents <ulong>(Data.Texture0);
     Data.Texture1            = ArrayFunctions.DoubleArraySizeAndKeepContents <ulong>(Data.Texture1);
     Data.TextureMode0        = ArrayFunctions.DoubleArraySizeAndKeepContents <TextureCoordinateMode>(Data.TextureMode0);
     Data.TextureMode1        = ArrayFunctions.DoubleArraySizeAndKeepContents <TextureCoordinateMode>(Data.TextureMode1);
     Data.Depths              = ArrayFunctions.DoubleArraySizeAndKeepContents <float>(Data.Depths);
     Data.Layers              = ArrayFunctions.DoubleArraySizeAndKeepContents <int>(Data.Layers);
 }