Esempio n. 1
0
        public static int Main()
        {
            int result = 100;

            Inner1 t1 = new Inner1(10);
            Outer1 o1;

            o1.i1    = 1;
            o1.l1    = 2;
            o1.inner = t1;
            long direct   = t1.sum();
            long indirect = test1(o1.inner);

            if (direct != indirect)
            {
                Console.WriteLine("t1.sum() returns " + direct + ", but test(o1.inner) returns " + indirect);
                result = -1;
            }

            Inner2 t2 = new Inner2(10);
            Outer2 o2;

            o2.i1    = 1;
            o2.l1    = 2;
            o2.inner = t2;
            direct   = t2.sum();
            indirect = test2(o2.inner);
            if (direct != indirect)
            {
                Console.WriteLine("t2.sum() returns " + direct + ", but test(o2.inner) returns " + indirect);
                result = -1;
            }

            return(result);
        }
Esempio n. 2
0
        public static int Main()
        {
            int result = 100;

            Inner1 t1 = new Inner1(10);
            Outer1 o1;
            o1.i1 = 1;
            o1.l1 = 2;
            o1.inner = t1;
            long direct = t1.sum();
            long indirect = test1(o1.inner);
            if (direct != indirect)
            {
                Console.WriteLine("t1.sum() returns " + direct + ", but test(o1.inner) returns " + indirect);
                result = -1;
            }

            Inner2 t2 = new Inner2(10);
            Outer2 o2;
            o2.i1 = 1;
            o2.l1 = 2;
            o2.inner = t2;
            direct = t2.sum();
            indirect = test2(o2.inner);
            if (direct != indirect)
            {
                Console.WriteLine("t2.sum() returns " + direct + ", but test(o2.inner) returns " + indirect);
                result = -1;
            }

            return result;
        }
Esempio n. 3
0
 static long test2(Inner2 s)
 {
     return(s.sum());
 }
Esempio n. 4
0
 static long test2(Inner2 s)
 {
     return s.sum();
 }