New test.
[mono.git] / mcs / tests / test-319-exe.cs
1 // Compiler options: -r:test-319-dll.dll
2
3 using System;
4 using System.Runtime.CompilerServices;
5
6 // TODO: clean up in Decimal.cs
7
8 public class ConstFields
9 {
10         public const decimal ConstDecimal1 = 314159265358979323846m;
11         public static readonly decimal ConstDecimal2 = -314159265358979323846m;
12         public const decimal ConstDecimal3 = -3;
13         public const decimal ConstDecimal4 = 0;
14         public const decimal MaxValue = 79228162514264337593543950335m;
15         
16         // TODO: check this value
17         static readonly Decimal MaxValueDiv10 = MaxValue / 10;
18             
19         static decimal DecimalValue = -90;
20             
21         static int Main ()
22         {
23             Type t = typeof (ConstFields);
24             DecimalConstantAttribute a = (DecimalConstantAttribute) t.GetField ("ConstDecimal3").GetCustomAttributes (typeof (DecimalConstantAttribute), false) [0];
25             if (a.Value != ConstDecimal3)
26                 return 1;
27
28             a = (DecimalConstantAttribute) t.GetField ("ConstDecimal1").GetCustomAttributes (typeof (DecimalConstantAttribute), false) [0];
29             if (a.Value != 314159265358979323846m)
30                 return 2;
31             
32             if (ConstDecimal1 != (-1) * ConstDecimal2)
33                 return 3;
34
35             // THIS IS TEST TOO
36             Console.WriteLine (C.D);
37             Console.WriteLine (Decimal.One);
38             Console.WriteLine (DecimalValue);
39             Console.WriteLine (Decimal.MaxValue);
40             
41             Console.WriteLine ("Success");
42             return 0;
43         }
44 }