Switch to compiler-tester
[mono.git] / mcs / tests / test-319.cs
1 // Compiler options: -r:test-319-lib.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         const decimal SmallConstValue = .02M;
21             
22         static int Main ()
23         {
24             Type t = typeof (ConstFields);
25             DecimalConstantAttribute a = (DecimalConstantAttribute) t.GetField ("ConstDecimal3").GetCustomAttributes (typeof (DecimalConstantAttribute), false) [0];
26             if (a.Value != ConstDecimal3)
27                 return 1;
28
29             a = (DecimalConstantAttribute) t.GetField ("ConstDecimal1").GetCustomAttributes (typeof (DecimalConstantAttribute), false) [0];
30             if (a.Value != 314159265358979323846m)
31                 return 2;
32             
33             if (ConstDecimal1 != (-1) * ConstDecimal2)
34                 return 3;
35             
36             if (!(SmallConstValue < 1 && SmallConstValue > 0))
37                 return 4;
38
39             // THIS IS TEST TOO
40             Console.WriteLine (C.D);
41             Console.WriteLine (Decimal.One);
42             Console.WriteLine (DecimalValue);
43             Console.WriteLine (Decimal.MaxValue);
44             
45             Console.WriteLine ("Success");
46             return 0;
47         }
48 }