예제 #1
0
        static int TestS8_Copy1()
        {
            S8     s1 = new S8();
            S8Copy s2 = new S8Copy();

            s2.i1 = 1;
            s2.i2 = 2;
            if (s1.i1 != 0)
            {
                return(101);
            }
            if (s1.i2 != 0)
            {
                return(101);
            }
            s1    = Unsafe.As <S8Copy, S8>(ref s2);
            s2.i1 = 3;
            s2.i2 = 4;
            if (s1.i1 != 1)
            {
                return(101);
            }
            if (s1.i2 != 2)
            {
                return(101);
            }

            if (s2.i1 != 3)
            {
                return(101);
            }
            if (s2.i2 != 4)
            {
                return(101);
            }
            return(100);
        }
예제 #2
0
        static int TestS8_Copy2()
        {
            S8Copy s1 = new S8Copy();
            S8     s2 = new S8();

            s2.i1 = 132;
            s2.i2 = 567;
            if (s1.i1 != 0)
            {
                return(101);
            }
            if (s1.i2 != 0)
            {
                return(101);
            }
            s1    = Unsafe.As <S8, S8Copy>(ref s2);
            s2.i1 = 32;
            s2.i2 = 33;
            if (s1.i1 != 132)
            {
                return(101);
            }
            if (s1.i2 != 567)
            {
                return(101);
            }
            if (s2.i1 == 132)
            {
                return(101);
            }
            if (s2.i2 != 33)
            {
                return(101);
            }
            return(100);
        }