diff options
author | Pat Gavlin <pagavlin@microsoft.com> | 2016-01-04 16:58:07 -0800 |
---|---|---|
committer | Pat Gavlin <pagavlin@microsoft.com> | 2016-01-05 08:58:09 -0800 |
commit | 1e2cb743851c9eb3c87dc071f81e8aa125ca1a4b (patch) | |
tree | 3f65a4ad05d7951d94c25b49f34e8be4524c3777 /tests/src/JIT/Regression/CLR-x86-JIT/v1-m08 | |
parent | 85f256e9b41cac20834d9695675e3ac8694454f9 (diff) | |
download | coreclr-1e2cb743851c9eb3c87dc071f81e8aa125ca1a4b.tar.gz coreclr-1e2cb743851c9eb3c87dc071f81e8aa125ca1a4b.tar.bz2 coreclr-1e2cb743851c9eb3c87dc071f81e8aa125ca1a4b.zip |
Port more JIT tests.
Most of these tests were blocked on unnecessary usage
of SerializableAttribute and Environment.ExitCode.
Diffstat (limited to 'tests/src/JIT/Regression/CLR-x86-JIT/v1-m08')
3 files changed, 427 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/CLR-x86-JIT/v1-m08/b12668/app.config b/tests/src/JIT/Regression/CLR-x86-JIT/v1-m08/b12668/app.config new file mode 100644 index 0000000000..8077c95440 --- /dev/null +++ b/tests/src/JIT/Regression/CLR-x86-JIT/v1-m08/b12668/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/Regression/CLR-x86-JIT/v1-m08/b12668/b12668.cs b/tests/src/JIT/Regression/CLR-x86-JIT/v1-m08/b12668/b12668.cs new file mode 100644 index 0000000000..bd2d55c824 --- /dev/null +++ b/tests/src/JIT/Regression/CLR-x86-JIT/v1-m08/b12668/b12668.cs @@ -0,0 +1,351 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + + + +namespace DefaultNamespace +{ + + using System; + + internal abstract class baseObject + { + private static int s_count = 0; + private static int s_id = 1; + + public virtual void changeCount(int amount) + { + if ((s_count + amount) < 0) + throw new ArgumentException(); + s_count += amount; + } + + internal abstract int getId(); + internal abstract float getArea(); + + public virtual int readId() + { + return s_id; + } + + public virtual int readcount() + { + return s_count; + } + } // baseObject + + + + + internal class Rectangle : baseObject + { + public static int count = 0; // same name as base member + internal static int id = 2; + + private float _dimension1; + private float _dimension2; + + internal Rectangle(float d1, float d2) + { + + _dimension1 = _dimension2 = (float)0.0; + + if ((d1 <= 0.0) || (d2 <= 0.0)) + throw new ArgumentException(); + _dimension1 = d1; + _dimension2 = d2; + changeCount(1); + } + + public override void changeCount(int amount) + { + base.changeCount(amount); + if ((count + amount) < 0) + throw new ArgumentException(); + count += amount; + } + + internal override float getArea() + { + float area; + area = _dimension1 * _dimension2; + return area; + } + + public virtual void remove() + { + changeCount(-1); + } + + internal override int getId() + { + return Rectangle.id; + } + } // class Rectangle + + + internal class Circle : baseObject + { + private float _radius = (float)0.0; + public int count = 0; // same name as base member + internal int id = 3; + + internal Circle(float r) + { + if (r <= 0.0) + throw new ArgumentException(); + _radius = r; + changeCount(1); + } + + + public override void changeCount(int amount) + { + if ((count + amount) < 0) + throw new ArgumentException(); + count += amount; + base.changeCount(amount); + } + + internal override float getArea() + { + float area; + area = (float)(3.14 * _radius * _radius); + return area; + } + + internal override int getId() + { + return id; + } + + virtual public void remove() + { + changeCount(-1); + } + } // class Circle + + + + public class EAObject + { + public static int Main(String[] args) + { + int successes = 0; + int result; + float area; + + baseObject[] aObjects = new baseObject[10]; + Rectangle rRectangle; + Circle rCircle; + + aObjects[0] = new Rectangle((float)5.0, (float)7.0); + + result = aObjects[0].getId(); + if (result != 2) + { + return 1; + } + else successes = 1; + + area = aObjects[0].getArea(); + if (area != 35.0) + { + return 1; + } + else successes++; + + + result = aObjects[0].readId(); + if (result != 1) + { + return 1; + } + else successes++; + + result = aObjects[0].readcount(); + if (result != 1) + { + return 1; + } + else successes++; + + aObjects[1] = new Circle((float)4.0); + + result = aObjects[1].getId(); + if (result != 3) + { + return 1; + } + else successes++; + + area = aObjects[1].getArea(); + if (area != (float)(4.0 * 4.0 * 3.14)) + { + return 1; + } + else successes++; + + + result = aObjects[1].readcount(); + if (result != 2) + { + return 1; + } + else successes++; + + rRectangle = (Rectangle)aObjects[0]; + result = Rectangle.count; + if (result != 1) + { + return 1; + } + else successes++; + + rCircle = (Circle)aObjects[1]; + result = rCircle.count; + if (result != 1) + { + return 1; + } + else successes++; + + bool ok = true; + int tryvar = 1; + try + { + aObjects[5] = new Rectangle((float)0.0, (float)7.0); + tryvar = 2; + } + catch (ArgumentException /*ae*/ ) + { + if (tryvar != 1) + { + return 1; + } + tryvar = 3; + } + finally + { + ok = tryvar == 3; + } + if (!ok) + { + return 1; + } + + tryvar = 1; + try + { + aObjects[5] = new Circle((float)0.0); + tryvar = 2; + } + catch (ArgumentException /*ae*/ ) + { + if (tryvar != 1) + { + return 1; + } + tryvar = 3; + } + finally + { + ok = tryvar == 3; + } + if (!ok) + { + return 1; + } + + try + { + tryvar = 1; + rRectangle.changeCount(-5); + } + catch (ArgumentException /*ae1*/ ) + { + tryvar = 2; + } + finally + { + ok = tryvar == 2; + } + if (!ok) + { + return 1; + } + + + aObjects[2] = new Rectangle((float)2.0, (float)3.0); + + result = aObjects[2].getId(); + if (result != 2) + { + return 1; + } + else successes++; + + area = aObjects[2].getArea(); + if (area != 6.0) + { + return 1; + } + else successes++; + + + result = aObjects[2].readId(); + if (result != 1) + { + return 1; + } + else successes++; + + result = aObjects[2].readcount(); + if (result != 3) + { + return 1; + } + else successes++; + + aObjects[3] = new Circle((float)8.0); + result = aObjects[3].getId(); + if (result != 3) + { + return 1; + } + else successes++; + + area = aObjects[3].getArea(); + if (area != (float)(8.0 * 8.0 * 3.14)) + { + return 1; + } + else successes++; + + + result = aObjects[3].readcount(); + if (result != 4) + { + return 1; + } + else successes++; + + + rRectangle = (Rectangle)aObjects[0]; + result = Rectangle.count; + if (result != 2) + { + return 1; + } + else successes++; + + rCircle = (Circle)aObjects[3]; + result = rCircle.count; + + + + return 100; + } // end main() + } // end class EAObject +} diff --git a/tests/src/JIT/Regression/CLR-x86-JIT/v1-m08/b12668/b12668.csproj b/tests/src/JIT/Regression/CLR-x86-JIT/v1-m08/b12668/b12668.csproj new file mode 100644 index 0000000000..2ea4761333 --- /dev/null +++ b/tests/src/JIT/Regression/CLR-x86-JIT/v1-m08/b12668/b12668.csproj @@ -0,0 +1,49 @@ +<?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>$(MSBuildProjectName)</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> + <PropertyGroup> + <DebugType>PdbOnly</DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="b12668.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file |