Abacus.DoublePrecision.Vector4Tests.Test_StructLayout_ii C# (CSharp) Method

Test_StructLayout_ii() private method

private Test_StructLayout_ii ( ) : void
return void
        public unsafe void Test_StructLayout_ii ()
        {
            for( Int32 i = 0; i < 100; ++ i)
            {
                Vector4 vec = GetNextRandomVector4();

                GCHandle h_vec = GCHandle.Alloc(vec, GCHandleType.Pinned);

                IntPtr vecAddress = h_vec.AddrOfPinnedObject();

                Double[] data = new Double[4];

                // nb: when Fixed32 and Half are moved back into the main
                //     dev branch there will be need for an extension method for
                //     Marshal that will perform the copy for those types.
                MarshalHelper.Copy(vecAddress, data, 0, 4);
                Assert.That(data[0], Is.EqualTo(vec.X));
                Assert.That(data[1], Is.EqualTo(vec.Y));
                Assert.That(data[2], Is.EqualTo(vec.Z));
                Assert.That(data[3], Is.EqualTo(vec.W));

                h_vec.Free();
            }
        }
Vector4Tests