summaryrefslogtreecommitdiff
path: root/mcs/tests/gtest-optional-11.cs
blob: 85b035de657ec22183e07e72896d62cdf5272d4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Compiler options: -r:gtest-optional-11-lib.dll

using System;
using System.Reflection;
using System.Runtime.InteropServices;

public class C
{
	public static int TestA ([Optional][DefaultParameterValue (1)] int u)
	{
		return u;
	}

	public static T TestB<T> (T a, [Optional] T u)
	{
		return u;
	}
	
	public static object TestC ([Optional] object a)
	{
		return a;
	}

	public static int TestD ([Optional] int a, int i)
	{
		return a;
	}

	public static int Main ()
	{
		if (TestA () != 1)
			return 1;

		if (TestB (-4) != 0)
			return 2;

		if (TestB ((object) null) != Missing.Value)
			return 3;

		if (TestC () != Missing.Value)
			return 4;
		
		if (TestD (i:2) != 0)
			return 5;
		
		if (Lib.TestA () != 1)
			return 11;

		if (Lib.TestB (-4) != 0)
			return 12;

		if (Lib.TestB ((object) null) != Missing.Value)
			return 13;

		if (Lib.TestC () != Missing.Value)
			return 14;
		
		if (Lib.TestC2 () != null)
			return 15;
		
		if (Lib.TestD (i:2) != 0)
			return 16;
		
		Lib.TestS ();
		
		return 0;
	}
}