示例#1
0
        Test33 test7(Test33 t5)
        {
            int fRes = t5.foo1.iFoo + t5.foo2.iFoo;

            Console.WriteLine("From Test7 members: {0} {1}", t5.foo1.iFoo, t5.foo2.iFoo);
            Console.WriteLine("From Test7: Res {0}", fRes);
            if (fRes != 43)
            {
                throw new Exception("Failed inside test6 test!");
            }

            Test33 tst5 = default(Test33);

            unsafe
            {
                // Force the use of GS check.
                int *array = stackalloc int[2];
                array[0] = 28;
                array[1] = 29;

                tst5.foo1      = new Foo3();
                tst5.foo2      = new Foo3();
                tst5.foo1.iFoo = array[0];
                tst5.foo2.iFoo = array[1];
            }

            return(tst5);
        }
示例#2
0
        Test33 test4()
        {
            Test33 test4 = default(Test33);
            Foo3   foo1  = new Foo3();
            Foo3   foo2  = new Foo3();

            foo1.iFoo  = 5;
            foo2.iFoo  = 6;
            test4.foo1 = foo1;
            test4.foo2 = foo2;
            return(test4);
        }
示例#3
0
        public static int Main1()
        {
            Program0 p = new Program0();

            Test30 t1Res = p.test1();

            Console.WriteLine("test1 Result: {0}", t1Res.i1 + t1Res.i2);
            if ((t1Res.i1 + t1Res.i2) != 3)
            {
                throw new Exception("Failed test1 test!");
            }

            Test31 t2Res = p.test2();

            Console.WriteLine("test2 Result: {0}", t2Res.foo1.iFoo);
            if (t2Res.foo1.iFoo != 3)
            {
                throw new Exception("Failed test2 test!");
            }

            Test32 t3Res = p.test3();

            Console.WriteLine("test3 Result: {0}", t3Res.i1 + t3Res.foo1.iFoo);
            if ((t3Res.i1 + t3Res.foo1.iFoo) != 7) // Adding HashCodes should be != 0.
            {
                throw new Exception("Failed test3 test!");
            }

            Test33 t4Res = p.test4();

            Console.WriteLine("test4 Result: {0}", t4Res.foo1.iFoo + t4Res.foo2.iFoo);
            if ((t4Res.foo1.iFoo + t4Res.foo2.iFoo) != 11)
            {
                throw new Exception("Failed test4 test!");
            }

            Test34 test5 = default(Test34);

            test5.i1 = 10;
            test5.i2 = 11;
            test5.f1 = 12;

            Test34 t5Res = p.test5(test5);

            Console.WriteLine("test5 Result: {0}", t5Res.i1 + t5Res.i2 + t5Res.f1);
            if ((t5Res.i1 + t5Res.i2 + t5Res.f1) != 42.0)
            {
                throw new Exception("Failed test5 test!");
            }

            return(100);
        }
示例#4
0
        Test33 test4()
        {
            Console.WriteLine("From Program0:test4!");
            Test33 test4 = default(Test33);
            Foo3   foo1  = new Foo3();
            Foo3   foo2  = new Foo3();

            foo1.iFoo  = 5;
            foo2.iFoo  = 6;
            test4.foo1 = foo1;
            test4.foo2 = foo2;
            return(test4);
        }
示例#5
0
        Test33 test7(Test33 t5)
        {    
            int fRes = t5.foo1.iFoo + t5.foo2.iFoo;    
            Console.WriteLine("From Test7 members: {0} {1}", t5.foo1.iFoo, t5.foo2.iFoo);    
            Console.WriteLine("From Test7: Res {0}", fRes);    
            if (fRes != 43) {    
                throw new Exception("Failed inside test6 test!");    
            }

            Test33 tst5 = default(Test33);

            unsafe
            {
                // Force the use of GS check.
                int* array = stackalloc int[2];
                array[0] = 28;
                array[1] = 29;

                tst5.foo1 = new Foo3();
                tst5.foo2 = new Foo3();
                tst5.foo1.iFoo = array[0];
                tst5.foo2.iFoo = array[1];
            }

            return tst5;    
        }