Abacus.DoublePrecision.QuaternionTests.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)
            {
                Quaternion quat = GetNextRandomQuaternion();

                GCHandle h_quat = GCHandle.Alloc(quat, GCHandleType.Pinned);

                IntPtr quatAddress = h_quat.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(quatAddress, data, 0, 4);
                Assert.That(data[0], Is.EqualTo(quat.I));
                Assert.That(data[1], Is.EqualTo(quat.J));
                Assert.That(data[2], Is.EqualTo(quat.K));
                Assert.That(data[3], Is.EqualTo(quat.U));

                h_quat.Free();
            }
        }