示例#1
0
        public void Copy_Vector2D()
        {
            // arrange
            const int BufferSize = 24;
            var       targetData = new int[BufferSize];
            var       srcData    = Enumerable.Range(0, BufferSize).ToArray();

            var target = new DataAndLayout <int>(targetData, new FastAccess(new Layout(new int[] { 2, 3, 4 }, 0, new int[] { 12, 4, 1 })));
            var src    = new DataAndLayout <int>(srcData, new FastAccess(new Layout(new int[] { 2, 3, 4 }, 0, new int[] { 12, 4, 1 })));

            // action
            ScalarOps.Copy(target, src);

            // assert
            Assert.IsTrue(Enumerable.SequenceEqual(targetData, srcData));
        }
示例#2
0
        public void Copy_Scalar()
        {
            // arrange
            var targetData = new int[1];
            var srcData    = new int[1];

            var       target      = new DataAndLayout <int>(targetData, new FastAccess(new Layout(new int[] { }, 0, new int[] { })));
            var       src         = new DataAndLayout <int>(srcData, new FastAccess(new Layout(new int[] { }, 0, new int[] { })));
            const int CopyPattern = 999;

            srcData[0] = CopyPattern;

            // action
            ScalarOps.Copy(target, src);

            // assert
            Assert.AreEqual(CopyPattern, targetData[0]);
        }