Example #1
0
        public static void Run()
        {
            string hw        = "Hello World";
            string roundtrip = new TestDelegateFatFunctionPointers().Generic <string>(hw);

            if (roundtrip != hw)
            {
                throw new Exception();
            }
        }
Example #2
0
    static int Main()
    {
        TestDictionaryDependencyTracking.Run();
        TestStaticBaseLookups.Run();
        TestInitThisClass.Run();
        TestDelegateFatFunctionPointers.Run();
        TestVirtualMethodUseTracking.Run();

        return(100);
    }
Example #3
0
    static int Main()
    {
        TestDictionaryDependencyTracking.Run();
        TestStaticBaseLookups.Run();
        TestInitThisClass.Run();
        TestDelegateFatFunctionPointers.Run();
        TestVirtualMethodUseTracking.Run();
        TestSlotsInHierarchy.Run();
        TestNameManglingCollisionRegression.Run();
        TestUnusedGVMsDoNotCrashCompiler.Run();

        return(100);
    }
Example #4
0
    static int Main()
    {
        TestDictionaryDependencyTracking.Run();
        TestStaticBaseLookups.Run();
        TestInitThisClass.Run();
        TestDelegateFatFunctionPointers.Run();
        TestVirtualMethodUseTracking.Run();
        TestSlotsInHierarchy.Run();
        TestReflectionInvoke.Run();
        TestDelegateVirtualMethod.Run();
        TestDelegateInterfaceMethod.Run();
        TestThreadStaticFieldAccess.Run();
        TestConstrainedMethodCalls.Run();
        TestInstantiatingUnboxingStubs.Run();
        TestMDArrayAddressMethod.Run();
        TestNameManglingCollisionRegression.Run();
        TestSimpleGVMScenarios.Run();

        return(100);
    }
Example #5
0
        public static void Run()
        {
            var o = new TestDelegateFatFunctionPointers();

            string hw        = "Hello World";
            string roundtrip = o.Generic <string>(hw);

            if (roundtrip != hw)
            {
                throw new Exception();
            }

            {
                VoidGenericDelegate <object> f = o.VoidGeneric;
                object obj      = new object();
                object location = null;
                f(ref location, obj);
                if (location != obj)
                {
                    throw new Exception();
                }
            }

            {
                Func <SmallStruct, SmallStruct> f = o.SmallStructGeneric <object>;
                SmallStruct x = new SmallStruct {
                    X = 12345
                };
                SmallStruct result = f(x);
                if (result.X != x.X)
                {
                    throw new Exception();
                }
            }

            {
                Func <MediumStruct, MediumStruct> f = o.MediumStructGeneric <object>;
                MediumStruct x = new MediumStruct {
                    X = 12, Y = 34, Z = 56, W = 78
                };
                MediumStruct result = f(x);
                if (result.X != x.X || result.Y != x.Y || result.Z != x.Z || result.W != x.W)
                {
                    throw new Exception();
                }
            }

            unsafe
            {
                Func <BigStruct, BigStruct> f = o.BigStructGeneric <object>;
                BigStruct x = new BigStruct();
                for (int i = 0; i < BigStruct.Length; i++)
                {
                    x.Bytes[i] = (byte)(i * 2);
                }

                BigStruct result = f(x);

                for (int i = 0; i < BigStruct.Length; i++)
                {
                    if (x.Bytes[i] != result.Bytes[i])
                    {
                        throw new Exception();
                    }
                }
            }
        }