2010-04-07 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / test-319.cs
blob6361e7a5d6217cd375cfd234923a27baf4e3f669
1 // Compiler options: -r:test-319-lib.dll
3 using System;
4 using System.Runtime.CompilerServices;
6 public class ConstFields
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;
15 // TODO: check this value
16 static readonly Decimal MaxValueDiv10 = MaxValue / 10;
18 static decimal DecimalValue = -90;
19 const decimal SmallConstValue = .02M;
21 static int Main ()
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;
28 a = (DecimalConstantAttribute) t.GetField ("ConstDecimal1").GetCustomAttributes (typeof (DecimalConstantAttribute), false)[0];
29 if (a.Value != 314159265358979323846m)
30 return 2;
32 if (ConstDecimal1 != (-1) * ConstDecimal2)
33 return 3;
35 if (!(SmallConstValue < 1 && SmallConstValue > 0))
36 return 4;
38 decimal ld = long.MaxValue;
39 Console.WriteLine (ld);
41 // THIS IS TEST TOO
42 Console.WriteLine (C.D);
43 Console.WriteLine (Decimal.One);
44 Console.WriteLine (DecimalValue);
45 Console.WriteLine (Decimal.MaxValue);
47 Console.WriteLine ("Success");
48 return 0;