Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-319.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 76d8765b87aa72a5ca7069e60f861aa12fa69eb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Compiler options: -r:test-319-lib.dll

using System;
using System.Runtime.CompilerServices;

public class ConstFields
{
	public const decimal ConstDecimal1 = 314159265358979323846m;
	public static readonly decimal ConstDecimal2 = -314159265358979323846m;
	public const decimal ConstDecimal3 = -3;
	public const decimal ConstDecimal4 = 0;
	public const decimal MaxValue = 79228162514264337593543950335m;
	public const decimal MaxLongValue = long.MaxValue;

	// TODO: check this value
	static readonly Decimal MaxValueDiv10 = MaxValue / 10;

	static decimal DecimalValue = -90;
	const decimal SmallConstValue = .02M;

	public static int Main ()
	{
		Type t = typeof (ConstFields);
		DecimalConstantAttribute a = (DecimalConstantAttribute) t.GetField ("ConstDecimal3").GetCustomAttributes (typeof (DecimalConstantAttribute), false)[0];
		if (a.Value != ConstDecimal3)
			return 1;

		a = (DecimalConstantAttribute) t.GetField ("ConstDecimal1").GetCustomAttributes (typeof (DecimalConstantAttribute), false)[0];
		if (a.Value != 314159265358979323846m)
			return 2;

		if (ConstDecimal1 != (-1) * ConstDecimal2)
			return 3;

		if (!(SmallConstValue < 1 && SmallConstValue > 0))
			return 4;

		decimal ld = long.MaxValue;
		Console.WriteLine (ld);

		// THIS IS TEST TOO
		Console.WriteLine (C.D);
		Console.WriteLine (Decimal.One);
		Console.WriteLine (DecimalValue);
		Console.WriteLine (Decimal.MaxValue);

		Console.WriteLine ("Success");
		return 0;
	}
}