Merge pull request #487 from mayerwin/patch-1
[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 public class ConstFields
7 {
8         public const decimal ConstDecimal1 = 314159265358979323846m;
9         public static readonly decimal ConstDecimal2 = -314159265358979323846m;
10         public const decimal ConstDecimal3 = -3;
11         public const decimal ConstDecimal4 = 0;
12         public const decimal MaxValue = 79228162514264337593543950335m;
13         public const decimal MaxLongValue = long.MaxValue;
14
15         // TODO: check this value
16         static readonly Decimal MaxValueDiv10 = MaxValue / 10;
17
18         static decimal DecimalValue = -90;
19         const decimal SmallConstValue = .02M;
20
21         public 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                 if (!(SmallConstValue < 1 && SmallConstValue > 0))
36                         return 4;
37
38                 decimal ld = long.MaxValue;
39                 Console.WriteLine (ld);
40
41                 // THIS IS TEST TOO
42                 Console.WriteLine (C.D);
43                 Console.WriteLine (Decimal.One);
44                 Console.WriteLine (DecimalValue);
45                 Console.WriteLine (Decimal.MaxValue);
46
47                 Console.WriteLine ("Success");
48                 return 0;
49         }
50 }