diff options
Diffstat (limited to 'tests')
46 files changed, 3956 insertions, 0 deletions
diff --git a/tests/src/AllTestProjects.sln b/tests/src/AllTestProjects.sln index 5895398e34..d8e968807c 100644 --- a/tests/src/AllTestProjects.sln +++ b/tests/src/AllTestProjects.sln @@ -115,6 +115,30 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cmov", "cmov", "{BA784A0F-E EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cmov", "JIT\Directed\cmov\cmov.csproj", "{472DA1F4-C446-434B-906C-A0F2899C279B}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Generics", "Generics", "{4528D9E6-C6F8-448E-BD36-5E5DAAFE90D3}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Arrays", "Arrays", "{C3F22F91-FE0E-4181-864B-D7EE7225382D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ConstructedTypes", "ConstructedTypes", "{C5825007-742C-4F16-BAB5-09D6EAF2AEF6}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TypeParameters", "TypeParameters", "{1E8B3DDB-15DC-4BB9-BAFB-8252848A8784}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Jagged", "Jagged", "{A1C4D795-DE5B-4CB0-BFF6-13E1D5A787FD}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MultiDim", "MultiDim", "{ADB4CA4A-288C-4C09-A5BE-D46112A52124}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Jagged", "Jagged", "{824E2C6A-EE65-43DA-B848-5FF3E4C68BDC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MultiDim", "MultiDim", "{7C6A86B2-9A8D-489B-A79B-A5721B0AAB62}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jagged", "JIT\Generics\Arrays\ConstructedTypes\Jagged\Jagged.csproj", "{ED2A35A7-094E-444E-A628-048C3C829F82}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiDim", "JIT\Generics\Arrays\ConstructedTypes\MultiDim\MultiDim.csproj", "{9E1A7A50-5698-433D-A1B1-B1DCA3975D4A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jagged", "JIT\Generics\Arrays\TypeParameters\Jagged\Jagged.csproj", "{6BDC2F0E-843B-406C-8783-E4EC783D3257}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiDim", "JIT\Generics\Arrays\TypeParameters\MultiDim\MultiDim.csproj", "{6992FF33-4A44-4788-9A39-7A8760AA54A5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -343,6 +367,46 @@ Global {472DA1F4-C446-434B-906C-A0F2899C279B}.Release|Mixed Platforms.Build.0 = Release|x64 {472DA1F4-C446-434B-906C-A0F2899C279B}.Release|x64.ActiveCfg = Release|x64 {472DA1F4-C446-434B-906C-A0F2899C279B}.Release|x64.Build.0 = Release|x64 + {ED2A35A7-094E-444E-A628-048C3C829F82}.Debug|Any CPU.ActiveCfg = Debug|x64 + {ED2A35A7-094E-444E-A628-048C3C829F82}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 + {ED2A35A7-094E-444E-A628-048C3C829F82}.Debug|Mixed Platforms.Build.0 = Debug|x64 + {ED2A35A7-094E-444E-A628-048C3C829F82}.Debug|x64.ActiveCfg = Debug|x64 + {ED2A35A7-094E-444E-A628-048C3C829F82}.Debug|x64.Build.0 = Debug|x64 + {ED2A35A7-094E-444E-A628-048C3C829F82}.Release|Any CPU.ActiveCfg = Release|x64 + {ED2A35A7-094E-444E-A628-048C3C829F82}.Release|Mixed Platforms.ActiveCfg = Release|x64 + {ED2A35A7-094E-444E-A628-048C3C829F82}.Release|Mixed Platforms.Build.0 = Release|x64 + {ED2A35A7-094E-444E-A628-048C3C829F82}.Release|x64.ActiveCfg = Release|x64 + {ED2A35A7-094E-444E-A628-048C3C829F82}.Release|x64.Build.0 = Release|x64 + {9E1A7A50-5698-433D-A1B1-B1DCA3975D4A}.Debug|Any CPU.ActiveCfg = Debug|x64 + {9E1A7A50-5698-433D-A1B1-B1DCA3975D4A}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 + {9E1A7A50-5698-433D-A1B1-B1DCA3975D4A}.Debug|Mixed Platforms.Build.0 = Debug|x64 + {9E1A7A50-5698-433D-A1B1-B1DCA3975D4A}.Debug|x64.ActiveCfg = Debug|x64 + {9E1A7A50-5698-433D-A1B1-B1DCA3975D4A}.Debug|x64.Build.0 = Debug|x64 + {9E1A7A50-5698-433D-A1B1-B1DCA3975D4A}.Release|Any CPU.ActiveCfg = Release|x64 + {9E1A7A50-5698-433D-A1B1-B1DCA3975D4A}.Release|Mixed Platforms.ActiveCfg = Release|x64 + {9E1A7A50-5698-433D-A1B1-B1DCA3975D4A}.Release|Mixed Platforms.Build.0 = Release|x64 + {9E1A7A50-5698-433D-A1B1-B1DCA3975D4A}.Release|x64.ActiveCfg = Release|x64 + {9E1A7A50-5698-433D-A1B1-B1DCA3975D4A}.Release|x64.Build.0 = Release|x64 + {6BDC2F0E-843B-406C-8783-E4EC783D3257}.Debug|Any CPU.ActiveCfg = Debug|x64 + {6BDC2F0E-843B-406C-8783-E4EC783D3257}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 + {6BDC2F0E-843B-406C-8783-E4EC783D3257}.Debug|Mixed Platforms.Build.0 = Debug|x64 + {6BDC2F0E-843B-406C-8783-E4EC783D3257}.Debug|x64.ActiveCfg = Debug|x64 + {6BDC2F0E-843B-406C-8783-E4EC783D3257}.Debug|x64.Build.0 = Debug|x64 + {6BDC2F0E-843B-406C-8783-E4EC783D3257}.Release|Any CPU.ActiveCfg = Release|x64 + {6BDC2F0E-843B-406C-8783-E4EC783D3257}.Release|Mixed Platforms.ActiveCfg = Release|x64 + {6BDC2F0E-843B-406C-8783-E4EC783D3257}.Release|Mixed Platforms.Build.0 = Release|x64 + {6BDC2F0E-843B-406C-8783-E4EC783D3257}.Release|x64.ActiveCfg = Release|x64 + {6BDC2F0E-843B-406C-8783-E4EC783D3257}.Release|x64.Build.0 = Release|x64 + {6992FF33-4A44-4788-9A39-7A8760AA54A5}.Debug|Any CPU.ActiveCfg = Debug|x64 + {6992FF33-4A44-4788-9A39-7A8760AA54A5}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 + {6992FF33-4A44-4788-9A39-7A8760AA54A5}.Debug|Mixed Platforms.Build.0 = Debug|x64 + {6992FF33-4A44-4788-9A39-7A8760AA54A5}.Debug|x64.ActiveCfg = Debug|x64 + {6992FF33-4A44-4788-9A39-7A8760AA54A5}.Debug|x64.Build.0 = Debug|x64 + {6992FF33-4A44-4788-9A39-7A8760AA54A5}.Release|Any CPU.ActiveCfg = Release|x64 + {6992FF33-4A44-4788-9A39-7A8760AA54A5}.Release|Mixed Platforms.ActiveCfg = Release|x64 + {6992FF33-4A44-4788-9A39-7A8760AA54A5}.Release|Mixed Platforms.Build.0 = Release|x64 + {6992FF33-4A44-4788-9A39-7A8760AA54A5}.Release|x64.ActiveCfg = Release|x64 + {6992FF33-4A44-4788-9A39-7A8760AA54A5}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -353,6 +417,7 @@ Global {954F04D0-2FFD-4923-BE9A-2F9F58145708} = {F03E5C26-F7BE-4BEF-9CBC-EAFC5A2C7760} {86AB78FA-656D-47D1-B156-F8165542A6C1} = {F03E5C26-F7BE-4BEF-9CBC-EAFC5A2C7760} {D9FFDA0F-00A2-458C-B3D3-77D0811E969E} = {F03E5C26-F7BE-4BEF-9CBC-EAFC5A2C7760} + {4528D9E6-C6F8-448E-BD36-5E5DAAFE90D3} = {F03E5C26-F7BE-4BEF-9CBC-EAFC5A2C7760} {B6FB99A0-1E53-4806-AE96-3A157F8B4DFD} = {3E36F081-F511-4C52-BC3D-2EEFECD3E880} {01516861-E37C-433B-9D12-CA4F8E05CB13} = {3E36F081-F511-4C52-BC3D-2EEFECD3E880} {9CF3FD0C-3643-4F57-A57C-492258FF1BF0} = {C86BB69B-B83E-4656-825F-50CADB38D344} @@ -395,5 +460,16 @@ Global {D63841EE-5F9D-4089-A9F6-D1D04DD30B78} = {816A193E-2D3A-4E4B-80FB-C9C322281F53} {BEED6C21-79A9-4E53-A362-74F0F53592C9} = {3AC4E363-B239-4D48-AEB8-A9177554E156} {472DA1F4-C446-434B-906C-A0F2899C279B} = {BA784A0F-E788-40CC-A76D-EB4041808897} + {C3F22F91-FE0E-4181-864B-D7EE7225382D} = {4528D9E6-C6F8-448E-BD36-5E5DAAFE90D3} + {C5825007-742C-4F16-BAB5-09D6EAF2AEF6} = {C3F22F91-FE0E-4181-864B-D7EE7225382D} + {1E8B3DDB-15DC-4BB9-BAFB-8252848A8784} = {C3F22F91-FE0E-4181-864B-D7EE7225382D} + {A1C4D795-DE5B-4CB0-BFF6-13E1D5A787FD} = {C5825007-742C-4F16-BAB5-09D6EAF2AEF6} + {ADB4CA4A-288C-4C09-A5BE-D46112A52124} = {C5825007-742C-4F16-BAB5-09D6EAF2AEF6} + {824E2C6A-EE65-43DA-B848-5FF3E4C68BDC} = {1E8B3DDB-15DC-4BB9-BAFB-8252848A8784} + {7C6A86B2-9A8D-489B-A79B-A5721B0AAB62} = {1E8B3DDB-15DC-4BB9-BAFB-8252848A8784} + {ED2A35A7-094E-444E-A628-048C3C829F82} = {A1C4D795-DE5B-4CB0-BFF6-13E1D5A787FD} + {9E1A7A50-5698-433D-A1B1-B1DCA3975D4A} = {ADB4CA4A-288C-4C09-A5BE-D46112A52124} + {6BDC2F0E-843B-406C-8783-E4EC783D3257} = {824E2C6A-EE65-43DA-B848-5FF3E4C68BDC} + {6992FF33-4A44-4788-9A39-7A8760AA54A5} = {7C6A86B2-9A8D-489B-A79B-A5721B0AAB62} EndGlobalSection EndGlobal diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/Jagged.csproj b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/Jagged.csproj new file mode 100644 index 0000000000..33b2928ebc --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/Jagged.csproj @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> + </PropertyGroup> + <Target Name="Build"> + <ItemGroup> + <AllSourceFiles Include="$(MSBuildProjectDirectory)\*.cs" /> + </ItemGroup> + <PropertyGroup> + <GenerateRunScript>false</GenerateRunScript> + </PropertyGroup> + <MSBuild Projects="cs_template.proj" Properties="AssemblyName1=%(AllSourceFiles.FileName);AllowUnsafeBlocks=True;IntermediateOutputPath=$(IntermediateOutputPath)\%(AllSourceFiles.FileName)\" /> + </Target> +</Project> diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/Struct01.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/Struct01.cs new file mode 100644 index 0000000000..7232615954 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/Struct01.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<int>[][][][][] GenArray = new Gen<int>[size][][][][]; + + + + for (i = 0; i < size; i++) + { + GenArray[i] = new Gen<int>[i][][][]; + for (j = 0; j < i; j++) + { + GenArray[i][j] = new Gen<int>[j][][]; + for (k = 0; k < j; k++) + { + GenArray[i][j][k] = new Gen<int>[k][]; + for (l = 0; l < k; l++) + { + GenArray[i][j][k][l] = new Gen<int>[l]; + for (m = 0; m < l; m++) + { + GenArray[i][j][k][l][m] = new Gen<int>(i * j * k * l * m); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += GenArray[i][j][k][l][m].Fld1; + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/Struct01_instance.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/Struct01_instance.cs new file mode 100644 index 0000000000..28d5f08863 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/Struct01_instance.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + + +public class ArrayHolder +{ + public Gen<int>[][][][][] GenArray = new Gen<int>[10][][][][]; +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + ArrayHolder ArrayHolderInst = new ArrayHolder(); + + for (i = 0; i < size; i++) + { + ArrayHolderInst.GenArray[i] = new Gen<int>[i][][][]; + for (j = 0; j < i; j++) + { + ArrayHolderInst.GenArray[i][j] = new Gen<int>[j][][]; + for (k = 0; k < j; k++) + { + ArrayHolderInst.GenArray[i][j][k] = new Gen<int>[k][]; + for (l = 0; l < k; l++) + { + ArrayHolderInst.GenArray[i][j][k][l] = new Gen<int>[l]; + for (m = 0; m < l; m++) + { + ArrayHolderInst.GenArray[i][j][k][l][m] = new Gen<int>(i * j * k * l * m); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += ArrayHolderInst.GenArray[i][j][k][l][m].Fld1; + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/app.config b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/app.config new file mode 100644 index 0000000000..62803f5972 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/app.config @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class01.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class01.cs new file mode 100644 index 0000000000..37bdce557f --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class01.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public class Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<int>[][][][][] GenArray = new Gen<int>[size][][][][]; + + + + for (i = 0; i < size; i++) + { + GenArray[i] = new Gen<int>[i][][][]; + for (j = 0; j < i; j++) + { + GenArray[i][j] = new Gen<int>[j][][]; + for (k = 0; k < j; k++) + { + GenArray[i][j][k] = new Gen<int>[k][]; + for (l = 0; l < k; l++) + { + GenArray[i][j][k][l] = new Gen<int>[l]; + for (m = 0; m < l; m++) + { + GenArray[i][j][k][l][m] = new Gen<int>(i * j * k * l * m); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += GenArray[i][j][k][l][m].Fld1; + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class01_instance.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class01_instance.cs new file mode 100644 index 0000000000..89676a5b53 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class01_instance.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public class Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + + +public class ArrayHolder +{ + public Gen<int>[][][][][] GenArray = new Gen<int>[10][][][][]; +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + ArrayHolder ArrayHolderInst = new ArrayHolder(); + + for (i = 0; i < size; i++) + { + ArrayHolderInst.GenArray[i] = new Gen<int>[i][][][]; + for (j = 0; j < i; j++) + { + ArrayHolderInst.GenArray[i][j] = new Gen<int>[j][][]; + for (k = 0; k < j; k++) + { + ArrayHolderInst.GenArray[i][j][k] = new Gen<int>[k][]; + for (l = 0; l < k; l++) + { + ArrayHolderInst.GenArray[i][j][k][l] = new Gen<int>[l]; + for (m = 0; m < l; m++) + { + ArrayHolderInst.GenArray[i][j][k][l][m] = new Gen<int>(i * j * k * l * m); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += ArrayHolderInst.GenArray[i][j][k][l][m].Fld1; + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class01_static.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class01_static.cs new file mode 100644 index 0000000000..576bf638c5 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class01_static.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public class Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + + +public class ArrayHolder +{ + public static Gen<int>[][][][][] GenArray = new Gen<int>[10][][][][]; +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + for (i = 0; i < size; i++) + { + ArrayHolder.GenArray[i] = new Gen<int>[i][][][]; + for (j = 0; j < i; j++) + { + ArrayHolder.GenArray[i][j] = new Gen<int>[j][][]; + for (k = 0; k < j; k++) + { + ArrayHolder.GenArray[i][j][k] = new Gen<int>[k][]; + for (l = 0; l < k; l++) + { + ArrayHolder.GenArray[i][j][k][l] = new Gen<int>[l]; + for (m = 0; m < l; m++) + { + ArrayHolder.GenArray[i][j][k][l][m] = new Gen<int>(i * j * k * l * m); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += ArrayHolder.GenArray[i][j][k][l][m].Fld1; + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class02.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class02.cs new file mode 100644 index 0000000000..441e392339 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class02.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public class Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<double>[][][][][] GenDoubleArray = new Gen<double>[size][][][][]; + + for (i = 0; i < size; i++) + { + GenDoubleArray[i] = new Gen<double>[i][][][]; + for (j = 0; j < i; j++) + { + GenDoubleArray[i][j] = new Gen<double>[j][][]; + for (k = 0; k < j; k++) + { + GenDoubleArray[i][j][k] = new Gen<double>[k][]; + for (l = 0; l < k; l++) + { + GenDoubleArray[i][j][k][l] = new Gen<double>[l]; + for (m = 0; m < l; m++) + { + GenDoubleArray[i][j][k][l][m] = new Gen<double>(i * j * k * l * m); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += GenDoubleArray[i][j][k][l][m].Fld1; + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class03.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class03.cs new file mode 100644 index 0000000000..9ef2d96c8c --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class03.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public class Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<string>[][][][][] GenStringArray = new Gen<string>[size][][][][]; + for (i = 0; i < size; i++) + { + GenStringArray[i] = new Gen<string>[i][][][]; + for (j = 0; j < i; j++) + { + GenStringArray[i][j] = new Gen<string>[j][][]; + for (k = 0; k < j; k++) + { + GenStringArray[i][j][k] = new Gen<string>[k][]; + for (l = 0; l < k; l++) + { + GenStringArray[i][j][k][l] = new Gen<string>[l]; + for (m = 0; m < l; m++) + { + GenStringArray[i][j][k][l][m] = new Gen<string>((i * j * k * l * m).ToString()); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += System.Int32.Parse(GenStringArray[i][j][k][l][m].Fld1); + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class04.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class04.cs new file mode 100644 index 0000000000..7de59f08e6 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class04.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public class Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<RefX1<int>>[][][][][] GenArray = new Gen<RefX1<int>>[size][][][][]; + + + + for (i = 0; i < size; i++) + { + GenArray[i] = new Gen<RefX1<int>>[i][][][]; + for (j = 0; j < i; j++) + { + GenArray[i][j] = new Gen<RefX1<int>>[j][][]; + for (k = 0; k < j; k++) + { + GenArray[i][j][k] = new Gen<RefX1<int>>[k][]; + for (l = 0; l < k; l++) + { + GenArray[i][j][k][l] = new Gen<RefX1<int>>[l]; + for (m = 0; m < l; m++) + { + GenArray[i][j][k][l][m] = new Gen<RefX1<int>>(new RefX1<int>(i * j * k * l * m)); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += GenArray[i][j][k][l][m].Fld1.t; + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class05.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class05.cs new file mode 100644 index 0000000000..1d78bdfd59 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class05.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public class Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<RefX1<string>>[][][][][] GenArray = new Gen<RefX1<string>>[size][][][][]; + + + + for (i = 0; i < size; i++) + { + GenArray[i] = new Gen<RefX1<string>>[i][][][]; + for (j = 0; j < i; j++) + { + GenArray[i][j] = new Gen<RefX1<string>>[j][][]; + for (k = 0; k < j; k++) + { + GenArray[i][j][k] = new Gen<RefX1<string>>[k][]; + for (l = 0; l < k; l++) + { + GenArray[i][j][k][l] = new Gen<RefX1<string>>[l]; + for (m = 0; m < l; m++) + { + GenArray[i][j][k][l][m] = new Gen<RefX1<string>>(new RefX1<string>((i * j * k * l * m).ToString())); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += System.Int32.Parse(GenArray[i][j][k][l][m].Fld1.t); + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class06.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class06.cs new file mode 100644 index 0000000000..6c05584268 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class06.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public class Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<ValX1<int>>[][][][][] GenArray = new Gen<ValX1<int>>[size][][][][]; + + + + for (i = 0; i < size; i++) + { + GenArray[i] = new Gen<ValX1<int>>[i][][][]; + for (j = 0; j < i; j++) + { + GenArray[i][j] = new Gen<ValX1<int>>[j][][]; + for (k = 0; k < j; k++) + { + GenArray[i][j][k] = new Gen<ValX1<int>>[k][]; + for (l = 0; l < k; l++) + { + GenArray[i][j][k][l] = new Gen<ValX1<int>>[l]; + for (m = 0; m < l; m++) + { + GenArray[i][j][k][l][m] = new Gen<ValX1<int>>(new ValX1<int>(i * j * k * l * m)); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += GenArray[i][j][k][l][m].Fld1.t; + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class07.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class07.cs new file mode 100644 index 0000000000..b8bac32c66 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/class07.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public class Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<ValX1<string>>[][][][][] GenArray = new Gen<ValX1<string>>[size][][][][]; + + + + for (i = 0; i < size; i++) + { + GenArray[i] = new Gen<ValX1<string>>[i][][][]; + for (j = 0; j < i; j++) + { + GenArray[i][j] = new Gen<ValX1<string>>[j][][]; + for (k = 0; k < j; k++) + { + GenArray[i][j][k] = new Gen<ValX1<string>>[k][]; + for (l = 0; l < k; l++) + { + GenArray[i][j][k][l] = new Gen<ValX1<string>>[l]; + for (m = 0; m < l; m++) + { + GenArray[i][j][k][l][m] = new Gen<ValX1<string>>(new ValX1<string>((i * j * k * l * m).ToString())); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += System.Int32.Parse(GenArray[i][j][k][l][m].Fld1.t); + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/cs_template.proj b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/cs_template.proj new file mode 100644 index 0000000000..adc2f21e14 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/cs_template.proj @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(AssemblyName1)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <ItemGroup> + <Compile Include="$(AssemblyName1).cs" /> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/packages.config b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/packages.config new file mode 100644 index 0000000000..06d3d11ead --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/packages.config @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="System.Console" version="4.0.0-beta-22405" /> + <package id="System.Runtime" version="4.0.20-beta-22405" /> + <package id="System.Runtime.Extensions" version="4.0.10-beta-22412" /> +</packages> diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struc01.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struc01.cs new file mode 100644 index 0000000000..7232615954 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struc01.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<int>[][][][][] GenArray = new Gen<int>[size][][][][]; + + + + for (i = 0; i < size; i++) + { + GenArray[i] = new Gen<int>[i][][][]; + for (j = 0; j < i; j++) + { + GenArray[i][j] = new Gen<int>[j][][]; + for (k = 0; k < j; k++) + { + GenArray[i][j][k] = new Gen<int>[k][]; + for (l = 0; l < k; l++) + { + GenArray[i][j][k][l] = new Gen<int>[l]; + for (m = 0; m < l; m++) + { + GenArray[i][j][k][l][m] = new Gen<int>(i * j * k * l * m); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += GenArray[i][j][k][l][m].Fld1; + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct01_static.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct01_static.cs new file mode 100644 index 0000000000..6596555335 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct01_static.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + + +public class ArrayHolder +{ + public static Gen<int>[][][][][] GenArray = new Gen<int>[10][][][][]; +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + for (i = 0; i < size; i++) + { + ArrayHolder.GenArray[i] = new Gen<int>[i][][][]; + for (j = 0; j < i; j++) + { + ArrayHolder.GenArray[i][j] = new Gen<int>[j][][]; + for (k = 0; k < j; k++) + { + ArrayHolder.GenArray[i][j][k] = new Gen<int>[k][]; + for (l = 0; l < k; l++) + { + ArrayHolder.GenArray[i][j][k][l] = new Gen<int>[l]; + for (m = 0; m < l; m++) + { + ArrayHolder.GenArray[i][j][k][l][m] = new Gen<int>(i * j * k * l * m); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += ArrayHolder.GenArray[i][j][k][l][m].Fld1; + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct02.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct02.cs new file mode 100644 index 0000000000..7178a91701 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct02.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<double>[][][][][] GenDoubleArray = new Gen<double>[size][][][][]; + + for (i = 0; i < size; i++) + { + GenDoubleArray[i] = new Gen<double>[i][][][]; + for (j = 0; j < i; j++) + { + GenDoubleArray[i][j] = new Gen<double>[j][][]; + for (k = 0; k < j; k++) + { + GenDoubleArray[i][j][k] = new Gen<double>[k][]; + for (l = 0; l < k; l++) + { + GenDoubleArray[i][j][k][l] = new Gen<double>[l]; + for (m = 0; m < l; m++) + { + GenDoubleArray[i][j][k][l][m] = new Gen<double>(i * j * k * l * m); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += GenDoubleArray[i][j][k][l][m].Fld1; + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct03.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct03.cs new file mode 100644 index 0000000000..8b06023d84 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct03.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<string>[][][][][] GenStringArray = new Gen<string>[size][][][][]; + for (i = 0; i < size; i++) + { + GenStringArray[i] = new Gen<string>[i][][][]; + for (j = 0; j < i; j++) + { + GenStringArray[i][j] = new Gen<string>[j][][]; + for (k = 0; k < j; k++) + { + GenStringArray[i][j][k] = new Gen<string>[k][]; + for (l = 0; l < k; l++) + { + GenStringArray[i][j][k][l] = new Gen<string>[l]; + for (m = 0; m < l; m++) + { + GenStringArray[i][j][k][l][m] = new Gen<string>((i * j * k * l * m).ToString()); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += System.Int32.Parse(GenStringArray[i][j][k][l][m].Fld1); + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct04.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct04.cs new file mode 100644 index 0000000000..181dcedab5 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct04.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<RefX1<int>>[][][][][] GenArray = new Gen<RefX1<int>>[size][][][][]; + + + + for (i = 0; i < size; i++) + { + GenArray[i] = new Gen<RefX1<int>>[i][][][]; + for (j = 0; j < i; j++) + { + GenArray[i][j] = new Gen<RefX1<int>>[j][][]; + for (k = 0; k < j; k++) + { + GenArray[i][j][k] = new Gen<RefX1<int>>[k][]; + for (l = 0; l < k; l++) + { + GenArray[i][j][k][l] = new Gen<RefX1<int>>[l]; + for (m = 0; m < l; m++) + { + GenArray[i][j][k][l][m] = new Gen<RefX1<int>>(new RefX1<int>(i * j * k * l * m)); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += GenArray[i][j][k][l][m].Fld1.t; + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct05.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct05.cs new file mode 100644 index 0000000000..c6261e4160 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct05.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<RefX1<string>>[][][][][] GenArray = new Gen<RefX1<string>>[size][][][][]; + + + + for (i = 0; i < size; i++) + { + GenArray[i] = new Gen<RefX1<string>>[i][][][]; + for (j = 0; j < i; j++) + { + GenArray[i][j] = new Gen<RefX1<string>>[j][][]; + for (k = 0; k < j; k++) + { + GenArray[i][j][k] = new Gen<RefX1<string>>[k][]; + for (l = 0; l < k; l++) + { + GenArray[i][j][k][l] = new Gen<RefX1<string>>[l]; + for (m = 0; m < l; m++) + { + GenArray[i][j][k][l][m] = new Gen<RefX1<string>>(new RefX1<string>((i * j * k * l * m).ToString())); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += System.Int32.Parse(GenArray[i][j][k][l][m].Fld1.t); + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct06.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct06.cs new file mode 100644 index 0000000000..388fa939d3 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct06.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<ValX1<int>>[][][][][] GenArray = new Gen<ValX1<int>>[size][][][][]; + + + + for (i = 0; i < size; i++) + { + GenArray[i] = new Gen<ValX1<int>>[i][][][]; + for (j = 0; j < i; j++) + { + GenArray[i][j] = new Gen<ValX1<int>>[j][][]; + for (k = 0; k < j; k++) + { + GenArray[i][j][k] = new Gen<ValX1<int>>[k][]; + for (l = 0; l < k; l++) + { + GenArray[i][j][k][l] = new Gen<ValX1<int>>[l]; + for (m = 0; m < l; m++) + { + GenArray[i][j][k][l][m] = new Gen<ValX1<int>>(new ValX1<int>(i * j * k * l * m)); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += GenArray[i][j][k][l][m].Fld1.t; + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct07.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct07.cs new file mode 100644 index 0000000000..ebb3789ece --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/Jagged/struct07.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k, l, m; + double sum = 0; + + Gen<ValX1<string>>[][][][][] GenArray = new Gen<ValX1<string>>[size][][][][]; + + + + for (i = 0; i < size; i++) + { + GenArray[i] = new Gen<ValX1<string>>[i][][][]; + for (j = 0; j < i; j++) + { + GenArray[i][j] = new Gen<ValX1<string>>[j][][]; + for (k = 0; k < j; k++) + { + GenArray[i][j][k] = new Gen<ValX1<string>>[k][]; + for (l = 0; l < k; l++) + { + GenArray[i][j][k][l] = new Gen<ValX1<string>>[l]; + for (m = 0; m < l; m++) + { + GenArray[i][j][k][l][m] = new Gen<ValX1<string>>(new ValX1<string>((i * j * k * l * m).ToString())); + } + } + } + } + } + + for (i = 0; i < size; i++) + { + for (j = 0; j < i; j++) + { + for (k = 0; k < j; k++) + { + for (l = 0; l < k; l++) + { + for (m = 0; m < l; m++) + { + sum += System.Int32.Parse(GenArray[i][j][k][l][m].Fld1.t); + } + } + } + } + } + + Eval(sum == 269325); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/MultiDim.csproj b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/MultiDim.csproj new file mode 100644 index 0000000000..33b2928ebc --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/MultiDim.csproj @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> + </PropertyGroup> + <Target Name="Build"> + <ItemGroup> + <AllSourceFiles Include="$(MSBuildProjectDirectory)\*.cs" /> + </ItemGroup> + <PropertyGroup> + <GenerateRunScript>false</GenerateRunScript> + </PropertyGroup> + <MSBuild Projects="cs_template.proj" Properties="AssemblyName1=%(AllSourceFiles.FileName);AllowUnsafeBlocks=True;IntermediateOutputPath=$(IntermediateOutputPath)\%(AllSourceFiles.FileName)\" /> + </Target> +</Project> diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/app.config b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/app.config new file mode 100644 index 0000000000..62803f5972 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/app.config @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/class01.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/class01.cs new file mode 100644 index 0000000000..03a78965a9 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/class01.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public class Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k; + double sum = 0; + int cLoc = 0; + + Gen<int>[, ,] GenArray = new Gen<int>[size, size, size]; + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + for (k = 0; (k < size); k++) + { + GenArray[i, j, k] = new Gen<int>(cLoc); + cLoc++; + } + } + } + + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + for (k = 0; (k < size); k++) + { + sum += GenArray[i, j, k].Fld1; + cLoc++; + } + } + } + + + + + Eval(sum == 499500); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/class01_Instance.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/class01_Instance.cs new file mode 100644 index 0000000000..c981ffdf28 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/class01_Instance.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public class Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class ArrayHolder +{ + public Gen<int>[, ,] GenArray = new Gen<int>[10, 10, 10]; +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k; + double sum = 0; + int cLoc = 0; + + ArrayHolder ArrayHolderInst = new ArrayHolder(); + + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + for (k = 0; (k < size); k++) + { + ArrayHolderInst.GenArray[i, j, k] = new Gen<int>(cLoc); + cLoc++; + } + } + } + + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + for (k = 0; (k < size); k++) + { + sum += ArrayHolderInst.GenArray[i, j, k].Fld1; + cLoc++; + } + } + } + + + + + Eval(sum == 499500); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/class01_static.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/class01_static.cs new file mode 100644 index 0000000000..e4b8f67caa --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/class01_static.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public class Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class ArrayHolder +{ + public static Gen<int>[, ,] GenArray = new Gen<int>[10, 10, 10]; +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k; + double sum = 0; + int cLoc = 0; + + + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + for (k = 0; (k < size); k++) + { + ArrayHolder.GenArray[i, j, k] = new Gen<int>(cLoc); + cLoc++; + } + } + } + + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + for (k = 0; (k < size); k++) + { + sum += ArrayHolder.GenArray[i, j, k].Fld1; + cLoc++; + } + } + } + + + + + Eval(sum == 499500); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/cs_template.proj b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/cs_template.proj new file mode 100644 index 0000000000..adc2f21e14 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/cs_template.proj @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(AssemblyName1)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <ItemGroup> + <Compile Include="$(AssemblyName1).cs" /> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/packages.config b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/packages.config new file mode 100644 index 0000000000..06d3d11ead --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/packages.config @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="System.Console" version="4.0.0-beta-22405" /> + <package id="System.Runtime" version="4.0.20-beta-22405" /> + <package id="System.Runtime.Extensions" version="4.0.10-beta-22412" /> +</packages> diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01.cs new file mode 100644 index 0000000000..862cc568ed --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k; + double sum = 0; + int cLoc = 0; + + Gen<int>[, ,] GenArray = new Gen<int>[size, size, size]; + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + for (k = 0; (k < size); k++) + { + GenArray[i, j, k] = new Gen<int>(cLoc); + cLoc++; + } + } + } + + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + for (k = 0; (k < size); k++) + { + sum += GenArray[i, j, k].Fld1; + cLoc++; + } + } + } + + + + + Eval(sum == 499500); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01_Instance.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01_Instance.cs new file mode 100644 index 0000000000..ea40ce96f2 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01_Instance.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class ArrayHolder +{ + public Gen<int>[, ,] GenArray = new Gen<int>[10, 10, 10]; +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k; + double sum = 0; + int cLoc = 0; + + ArrayHolder ArrayHolderInst = new ArrayHolder(); + + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + for (k = 0; (k < size); k++) + { + ArrayHolderInst.GenArray[i, j, k] = new Gen<int>(cLoc); + cLoc++; + } + } + } + + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + for (k = 0; (k < size); k++) + { + sum += ArrayHolderInst.GenArray[i, j, k].Fld1; + cLoc++; + } + } + } + + + + + Eval(sum == 499500); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01_static.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01_static.cs new file mode 100644 index 0000000000..0b505f7e7e --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01_static.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public T Fld1; + + public Gen(T fld1) + { + Fld1 = fld1; + } + + +} + +public class ArrayHolder +{ + public static Gen<int>[, ,] GenArray = new Gen<int>[10, 10, 10]; +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int size = 10; + int i, j, k; + double sum = 0; + int cLoc = 0; + + + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + for (k = 0; (k < size); k++) + { + ArrayHolder.GenArray[i, j, k] = new Gen<int>(cLoc); + cLoc++; + } + } + } + + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + for (k = 0; (k < size); k++) + { + sum += ArrayHolder.GenArray[i, j, k].Fld1; + cLoc++; + } + } + } + + + + + Eval(sum == 499500); + sum = 0; + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/Jagged.csproj b/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/Jagged.csproj new file mode 100644 index 0000000000..33b2928ebc --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/Jagged.csproj @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> + </PropertyGroup> + <Target Name="Build"> + <ItemGroup> + <AllSourceFiles Include="$(MSBuildProjectDirectory)\*.cs" /> + </ItemGroup> + <PropertyGroup> + <GenerateRunScript>false</GenerateRunScript> + </PropertyGroup> + <MSBuild Projects="cs_template.proj" Properties="AssemblyName1=%(AllSourceFiles.FileName);AllowUnsafeBlocks=True;IntermediateOutputPath=$(IntermediateOutputPath)\%(AllSourceFiles.FileName)\" /> + </Target> +</Project> diff --git a/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/app.config b/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/app.config new file mode 100644 index 0000000000..62803f5972 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/app.config @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/class01.cs b/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/class01.cs new file mode 100644 index 0000000000..793cca3ed3 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/class01.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public class Gen<T> +{ + public static int size = 10; + + + + public T[][] TArray; + + public void StoreTArray(T[] arr) + { + TArray = new T[size][]; + int i, j; + + for (i = 0; (i < size); i++) + { + TArray[i] = new T[size]; + for (j = 0; (j < size); j++) + { + TArray[i][j] = arr[(i * 10) + j]; + } + } + } + + public void LoadTArray(out T[] arr) + { + arr = new T[size * size]; + int i, j; + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + arr[(i * 10) + j] = TArray[i][j]; + } + } + } + + public bool VerifyTArray(T[] arr) + { + int i, j; + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + if (!(arr[(i * 10) + j].Equals(TArray[i][j]))) + { + Console.WriteLine("Failed Verification of Element TArray[{0}][{1}]", i, j); + return false; + } + } + } + return true; + } + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int i = 0; + + int[] IntArr_in = new int[100]; + for (i = 0; (i < (10 * 10)); i++) + { + IntArr_in[i] = i; + } + + int[] IntArr_out; + Gen<int> GenInt = new Gen<int>(); + GenInt.StoreTArray(IntArr_in); + GenInt.LoadTArray(out IntArr_out); + Eval(GenInt.VerifyTArray(IntArr_out)); + + double[] DoubleArr_in = new double[100]; + for (i = 0; (i < 10 * 10); i++) + { + DoubleArr_in[i] = i; + } + + double[] DoubleArr_out; + Gen<double> GenDouble = new Gen<double>(); + GenDouble.StoreTArray(DoubleArr_in); + GenDouble.LoadTArray(out DoubleArr_out); + Eval(GenDouble.VerifyTArray(DoubleArr_out)); + + + string[] StringArr_in = new String[100]; + for (i = 0; (i < 10 * 10); i++) + { + StringArr_in[i] = i.ToString(); + } + + String[] StringArr_out; + Gen<String> GenString = new Gen<String>(); + GenString.StoreTArray(StringArr_in); + GenString.LoadTArray(out StringArr_out); + Eval(GenString.VerifyTArray(StringArr_out)); + + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/cs_template.proj b/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/cs_template.proj new file mode 100644 index 0000000000..adc2f21e14 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/cs_template.proj @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(AssemblyName1)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <ItemGroup> + <Compile Include="$(AssemblyName1).cs" /> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> diff --git a/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/packages.config b/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/packages.config new file mode 100644 index 0000000000..06d3d11ead --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/packages.config @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="System.Console" version="4.0.0-beta-22405" /> + <package id="System.Runtime" version="4.0.20-beta-22405" /> + <package id="System.Runtime.Extensions" version="4.0.10-beta-22412" /> +</packages> diff --git a/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/struct01.cs b/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/struct01.cs new file mode 100644 index 0000000000..bbbe5ee402 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/TypeParameters/Jagged/struct01.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public static int size = 10; + + + + public T[][] TArray; + + public void StoreTArray(T[] arr) + { + TArray = new T[size][]; + int i, j; + + for (i = 0; (i < size); i++) + { + TArray[i] = new T[size]; + for (j = 0; (j < size); j++) + { + TArray[i][j] = arr[(i * 10) + j]; + } + } + } + + public void LoadTArray(out T[] arr) + { + arr = new T[size * size]; + int i, j; + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + arr[(i * 10) + j] = TArray[i][j]; + } + } + } + + public bool VerifyTArray(T[] arr) + { + int i, j; + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + if (!(arr[(i * 10) + j].Equals(TArray[i][j]))) + { + Console.WriteLine("Failed Verification of Element TArray[{0}][{1}]", i, j); + return false; + } + } + } + return true; + } + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int i = 0; + + int[] IntArr_in = new int[100]; + for (i = 0; (i < (10 * 10)); i++) + { + IntArr_in[i] = i; + } + + int[] IntArr_out; + Gen<int> GenInt = new Gen<int>(); + GenInt.StoreTArray(IntArr_in); + GenInt.LoadTArray(out IntArr_out); + Eval(GenInt.VerifyTArray(IntArr_out)); + + double[] DoubleArr_in = new double[100]; + for (i = 0; (i < 10 * 10); i++) + { + DoubleArr_in[i] = i; + } + + double[] DoubleArr_out; + Gen<double> GenDouble = new Gen<double>(); + GenDouble.StoreTArray(DoubleArr_in); + GenDouble.LoadTArray(out DoubleArr_out); + Eval(GenDouble.VerifyTArray(DoubleArr_out)); + + + string[] StringArr_in = new String[100]; + for (i = 0; (i < 10 * 10); i++) + { + StringArr_in[i] = i.ToString(); + } + + String[] StringArr_out; + Gen<String> GenString = new Gen<String>(); + GenString.StoreTArray(StringArr_in); + GenString.LoadTArray(out StringArr_out); + Eval(GenString.VerifyTArray(StringArr_out)); + + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/MultiDim.csproj b/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/MultiDim.csproj new file mode 100644 index 0000000000..33b2928ebc --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/MultiDim.csproj @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> + </PropertyGroup> + <Target Name="Build"> + <ItemGroup> + <AllSourceFiles Include="$(MSBuildProjectDirectory)\*.cs" /> + </ItemGroup> + <PropertyGroup> + <GenerateRunScript>false</GenerateRunScript> + </PropertyGroup> + <MSBuild Projects="cs_template.proj" Properties="AssemblyName1=%(AllSourceFiles.FileName);AllowUnsafeBlocks=True;IntermediateOutputPath=$(IntermediateOutputPath)\%(AllSourceFiles.FileName)\" /> + </Target> +</Project> diff --git a/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/app.config b/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/app.config new file mode 100644 index 0000000000..62803f5972 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/app.config @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/class01.cs b/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/class01.cs new file mode 100644 index 0000000000..cadca7a368 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/class01.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public class Gen<T> +{ + public static int size = 10; + + + + public T[,] TArray; + + public void StoreTArray(T[] arr) + { + TArray = new T[size, size]; + int i, j; + + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + TArray[i, j] = arr[(i * 10) + j]; + } + } + } + + public void LoadTArray(out T[] arr) + { + arr = new T[size * size]; + int i, j; + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + arr[(i * 10) + j] = TArray[i, j]; + } + } + } + + public bool VerifyTArray(T[] arr) + { + int i, j; + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + if (!(arr[(i * 10) + j].Equals(TArray[i, j]))) + { + Console.WriteLine("Failed Verification of Element TArray[{0}][{1}]", i, j); + return false; + } + } + } + return true; + } + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int i = 0; + + int[] IntArr_in = new int[100]; + for (i = 0; (i < (10 * 10)); i++) + { + IntArr_in[i] = i; + } + + int[] IntArr_out; + Gen<int> GenInt = new Gen<int>(); + GenInt.StoreTArray(IntArr_in); + GenInt.LoadTArray(out IntArr_out); + Eval(GenInt.VerifyTArray(IntArr_out)); + + double[] DoubleArr_in = new double[100]; + for (i = 0; (i < 10 * 10); i++) + { + DoubleArr_in[i] = i; + } + + double[] DoubleArr_out; + Gen<double> GenDouble = new Gen<double>(); + GenDouble.StoreTArray(DoubleArr_in); + GenDouble.LoadTArray(out DoubleArr_out); + Eval(GenDouble.VerifyTArray(DoubleArr_out)); + + + string[] StringArr_in = new String[100]; + for (i = 0; (i < 10 * 10); i++) + { + StringArr_in[i] = i.ToString(); + } + + String[] StringArr_out; + Gen<String> GenString = new Gen<String>(); + GenString.StoreTArray(StringArr_in); + GenString.LoadTArray(out StringArr_out); + Eval(GenString.VerifyTArray(StringArr_out)); + + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + diff --git a/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/cs_template.proj b/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/cs_template.proj new file mode 100644 index 0000000000..adc2f21e14 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/cs_template.proj @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(AssemblyName1)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <ItemGroup> + <Compile Include="$(AssemblyName1).cs" /> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> diff --git a/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/packages.config b/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/packages.config new file mode 100644 index 0000000000..06d3d11ead --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/packages.config @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="System.Console" version="4.0.0-beta-22405" /> + <package id="System.Runtime" version="4.0.20-beta-22405" /> + <package id="System.Runtime.Extensions" version="4.0.10-beta-22412" /> +</packages> diff --git a/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/struct01.cs b/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/struct01.cs new file mode 100644 index 0000000000..8cd5375852 --- /dev/null +++ b/tests/src/JIT/Generics/Arrays/TypeParameters/MultiDim/struct01.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +public struct ValX1<T> +{ + public T t; + public ValX1(T t) + { + this.t = t; + } + +} +public class RefX1<T> +{ + public T t; + public RefX1(T t) + { + this.t = t; + } +} + + +public struct Gen<T> +{ + public static int size = 10; + + + + public T[,] TArray; + + public void StoreTArray(T[] arr) + { + TArray = new T[size, size]; + int i, j; + + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + TArray[i, j] = arr[(i * 10) + j]; + } + } + } + + public void LoadTArray(out T[] arr) + { + arr = new T[size * size]; + int i, j; + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + arr[(i * 10) + j] = TArray[i, j]; + } + } + } + + public bool VerifyTArray(T[] arr) + { + int i, j; + for (i = 0; (i < size); i++) + { + for (j = 0; (j < size); j++) + { + if (!(arr[(i * 10) + j].Equals(TArray[i, j]))) + { + Console.WriteLine("Failed Verification of Element TArray[{0}][{1}]", i, j); + return false; + } + } + } + return true; + } + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + int i = 0; + + int[] IntArr_in = new int[100]; + for (i = 0; (i < (10 * 10)); i++) + { + IntArr_in[i] = i; + } + + int[] IntArr_out; + Gen<int> GenInt = new Gen<int>(); + GenInt.StoreTArray(IntArr_in); + GenInt.LoadTArray(out IntArr_out); + Eval(GenInt.VerifyTArray(IntArr_out)); + + double[] DoubleArr_in = new double[100]; + for (i = 0; (i < 10 * 10); i++) + { + DoubleArr_in[i] = i; + } + + double[] DoubleArr_out; + Gen<double> GenDouble = new Gen<double>(); + GenDouble.StoreTArray(DoubleArr_in); + GenDouble.LoadTArray(out DoubleArr_out); + Eval(GenDouble.VerifyTArray(DoubleArr_out)); + + + string[] StringArr_in = new String[100]; + for (i = 0; (i < 10 * 10); i++) + { + StringArr_in[i] = i.ToString(); + } + + String[] StringArr_out; + Gen<String> GenString = new Gen<String>(); + GenString.StoreTArray(StringArr_in); + GenString.LoadTArray(out StringArr_out); + Eval(GenString.VerifyTArray(StringArr_out)); + + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + } + +} + |