Take stars out of types where they make more sense.
[mono-project.git] / mcs / tests / gtest-optional-01.cs
blob7c8dfc49055e25264f7ef63789b173f897106a59
1 using System;
2 using System.Runtime.InteropServices;
3 using System.Reflection;
5 public class C
7 public static void TestA ([Optional][DefaultParameterValue (1)] int u)
11 public static void TestB (long u = 12)
15 public static void TestC (decimal d = decimal.MaxValue)
19 public static int Main ()
21 ParameterInfo[] info = typeof (C).GetMethod ("TestA").GetParameters ();
23 if (info[0].DefaultValue.GetType () != typeof (int))
24 return 1;
26 if ((int) info[0].DefaultValue != 1)
27 return 2;
29 if (!info[0].IsOptional)
30 return 3;
32 info = typeof (C).GetMethod ("TestB").GetParameters ();
34 if (info[0].DefaultValue.GetType () != typeof (long))
35 return 11;
37 if ((long) info[0].DefaultValue != 12)
38 return 12;
40 if (!info[0].IsOptional)
41 return 13;
43 info = typeof (C).GetMethod ("TestC").GetParameters ();
45 if (info[0].DefaultValue.GetType () != typeof (decimal))
46 return 21;
48 if ((decimal) info[0].DefaultValue != decimal.MaxValue)
49 return 22;
51 if (!info[0].IsOptional)
52 return 23;
54 Console.WriteLine ("ok");
55 return 0;