Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 35b25fe

Browse files
committed
add a few more test cases
1 parent 9c52f33 commit 35b25fe

File tree

4 files changed

+186
-0
lines changed

4 files changed

+186
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System;
6+
7+
public struct V
8+
{
9+
public V(int x)
10+
{
11+
Token = x;
12+
}
13+
14+
public int Token;
15+
}
16+
17+
class M
18+
{
19+
static int F(int x, object a)
20+
{
21+
int result = 0;
22+
23+
if (a is V)
24+
{
25+
int token = ((V)a).Token;
26+
Console.WriteLine("F: Token is {0}", token);
27+
result = x + token;
28+
}
29+
30+
return result;
31+
}
32+
33+
static int G(object a, int x)
34+
{
35+
return F(x, a);
36+
}
37+
38+
static int Trouble(ref V v)
39+
{
40+
Console.WriteLine("T: Token is {0}", v.Token);
41+
int result = v.Token;
42+
v.Token++;
43+
return result;
44+
}
45+
46+
public static int Main()
47+
{
48+
// Ensure we get right order of side effects from boxes
49+
// now that we are splitting them into multiple statments.
50+
V v1 = new V(11);
51+
int result1 = F(Trouble(ref v1), v1);
52+
V v2 = new V(11);
53+
int result2 = G(v2, Trouble(ref v2));
54+
Console.WriteLine("Result1 = {0}; Result2 = {1}", result1, result2);
55+
return result1 + result2 + 55;
56+
}
57+
}
58+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
8+
<SchemaVersion>2.0</SchemaVersion>
9+
<ProjectGuid>{7B521917-193E-48BB-86C6-FE013F3DFF35}</ProjectGuid>
10+
<OutputType>Exe</OutputType>
11+
<AppDesignerFolder>Properties</AppDesignerFolder>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
15+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
16+
17+
<NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
18+
</PropertyGroup>
19+
<!-- Default configurations to help VS understand the configurations -->
20+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
21+
</PropertyGroup>
22+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23+
</PropertyGroup>
24+
<ItemGroup>
25+
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
26+
<Visible>False</Visible>
27+
</CodeAnalysisDependentAssemblyPaths>
28+
</ItemGroup>
29+
<PropertyGroup>
30+
<DebugType></DebugType>
31+
<Optimize>True</Optimize>
32+
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Compile Include="$(MSBuildProjectName).cs" />
36+
</ItemGroup>
37+
<ItemGroup>
38+
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
39+
</ItemGroup>
40+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
41+
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
42+
</PropertyGroup>
43+
</Project>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Numerics;
8+
9+
public class X<K>
10+
{
11+
public X(K k1)
12+
{
13+
k = k1;
14+
}
15+
16+
[MethodImpl(MethodImplOptions.NoInlining)]
17+
public static bool Test(X<K> a)
18+
{
19+
return (a.k != null);
20+
}
21+
22+
public K k;
23+
}
24+
25+
class B
26+
{
27+
public static int Main()
28+
{
29+
X<Vector3> a = null;
30+
bool result = false;
31+
try
32+
{
33+
X<Vector3>.Test(a);
34+
}
35+
catch (Exception)
36+
{
37+
result = true;
38+
}
39+
Console.WriteLine("Passed: {0}", result);
40+
return result ? 100 : 0;
41+
}
42+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
8+
<SchemaVersion>2.0</SchemaVersion>
9+
<ProjectGuid>{7B521917-193E-48BB-86C6-FE013F3DFF35}</ProjectGuid>
10+
<OutputType>Exe</OutputType>
11+
<AppDesignerFolder>Properties</AppDesignerFolder>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
15+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
16+
17+
<NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
18+
</PropertyGroup>
19+
<!-- Default configurations to help VS understand the configurations -->
20+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
21+
</PropertyGroup>
22+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23+
</PropertyGroup>
24+
<ItemGroup>
25+
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
26+
<Visible>False</Visible>
27+
</CodeAnalysisDependentAssemblyPaths>
28+
</ItemGroup>
29+
<PropertyGroup>
30+
<DebugType></DebugType>
31+
<Optimize>True</Optimize>
32+
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Compile Include="$(MSBuildProjectName).cs" />
36+
</ItemGroup>
37+
<ItemGroup>
38+
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
39+
</ItemGroup>
40+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
41+
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
42+
</PropertyGroup>
43+
</Project>

0 commit comments

Comments
 (0)