In ilasm/tests:
[mcs.git] / tests / test-319.cs
blob3bb1e354ef6ec13f58689a1c93c65d72d95e2034
1 // Compiler options: -r:test-319-lib.dll
3 using System;
4 using System.Runtime.CompilerServices;
6 // TODO: clean up in Decimal.cs
8 public class ConstFields
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;
16 // TODO: check this value
17 static readonly Decimal MaxValueDiv10 = MaxValue / 10;
19 static decimal DecimalValue = -90;
20 const decimal SmallConstValue = .02M;
22 static int Main ()
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;
29 a = (DecimalConstantAttribute) t.GetField ("ConstDecimal1").GetCustomAttributes (typeof (DecimalConstantAttribute), false) [0];
30 if (a.Value != 314159265358979323846m)
31 return 2;
33 if (ConstDecimal1 != (-1) * ConstDecimal2)
34 return 3;
36 if (!(SmallConstValue < 1 && SmallConstValue > 0))
37 return 4;
39 // THIS IS TEST TOO
40 Console.WriteLine (C.D);
41 Console.WriteLine (Decimal.One);
42 Console.WriteLine (DecimalValue);
43 Console.WriteLine (Decimal.MaxValue);
45 Console.WriteLine ("Success");
46 return 0;